Forum Moderators: coopster

Message Too Old, No Replies

Assistance with MYSQL Custom View

How to calculate field data in db

         

jimbob45506

11:59 pm on Mar 30, 2005 (gmt 0)

10+ Year Member



I am using a PHP program (AppGini) to write a repair and invoice database. As far as getting the tables, fields, etc. setup, all is going well.

My client wishes to view the invoice table data, via a web browser, as if it were an on-line invoice. I am sure other requests will be added later.

The fields to calculate are: hours [times] rate [plus] material(costs) [=] Total.

I am proficient in HTML but new to PHP and MySQL.

Is there a valid syntax to use for above or a good software program that a newbie can use to design/publish custom views/reports in PHP/HTML for MySQL?

I am working with PHP rev. 4.3.10 and MySQL rev. 4.0.22.

Thanks for all replies.

coopster

12:13 am on Mar 31, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hi jimbob45506.

I see you had a similar question [webmasterworld.com] awhile back. Have you come across phpMyAdmin yet? I don't use it myself but know that quite a few folks around here do.

gardenguy

10:04 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



jimbob,
Do you have a form set up to collect the data?
if yes, a very primitive script, which is hard coded numbers and has no error checking would be:
<?
echo "Invoice<br>";
$hours = 6;
$rate= 12.50;
$material = 150;
echo "hours: $hours <br>rate: $rate<br>material: $material";
$tot = ($hours * $rate) + $material;
echo "<br>total = $tot (which better be 225)";
?>
If you have the form, then you would use data from the form (post or get) to replace the hours/rate/material as in, for example:
$hours = $_POST['hours'];
etc.
We can work from here.

jimbob45506

12:37 pm on Apr 2, 2005 (gmt 0)

10+ Year Member



Thanks for the form info...I will substitute it and see how it goes.

I have PHPAdmin on my server but the form to display the info is my "challenge". PHPAdmin only interfaces on the backend, not the user end. The client wants to have a simple read of the data. :)