-
- Echoing PHP calculation results
-
Echoing PHP calculation results
I am building a calculator that should be able to calculate the total cost of a floor by imputting the dimensions. I have worked out the calculation and done a form that saves the persons choices to the database.If the floor is 12X13 then the php to calculate is as follows: if ($_GET['calc'] == "yes") { $width = $_GET['width']; $length = $_GET['length']; $firstCal = ($length + 6); $secCal = ($width + 6) / 3; $flat = ($firstCal)*($secCal); //each represent type of flooring multiply by rate for material $flatC = $flat * 15; $flatT = $flat * 13; $flatW = $flat * 18; ceil($flat); print "<h3>FLAT</h3>"; print "TOTAL IN LINEAR FEET $flat<p>"; print "PRICE TT$: Clay $flatC.00, Wood $flatW.00, Tile $flatT.00"; My question how do i echo the results based on the choice made from the database onto a total sheet. (or what steps to try if the person choose a concrete floor with wood. Database: lenght=> width=> floor type=> covering I need help dont now what the next step in echoing the results
-
-
Selecting multiple values from a database
I built the tables but in the choice table i used the names instead not the shoeid or sockid. I can rework this. The reason i used the names is for when the admin logs in they can view by the orderid or memberid and the exact details will show. I built the calculations separate using php on a page called total.php. My question is how do i calculate the total based on the choice from the table. e.g choice1 in ur table how do i select the shoe price e.g SELECT * FROM Choice where choiceid = $memberid; then i echo the result. Do i use an IF/ELSE statement ... but i am stuck here i dont know what to do. I failed my final yr project and i really need some help. Thanks for the response and help
-
Selecting multiple values from a database
Ok let me see how to explain this: I have a database with shoes and sock with a cost. The user goes thru and a series of steps in a form and it saves to the database. I wrote calculations that calculates the cost of a shoe and the cost of a socks but i worked it out on a sheet called 'total.php'. $nike, $reebok and for socks $blue, $red So a person can choose a nike shoe and blue sock, or a nike shoe and red sock. Or the person can choose a reebok shoe and a blue sock or a reebok shoe and red sock. So i use a select statement to recall what was chosen : SELECT * FROM Choice where memberid = $userid; and this works. What do i do next: Do i use an if, else statement?? My predicament is how do i go about selecting the cost of a shoe and sock and echoing the results on a separate sheet?
-
displaying images in a webpage using php
The following is the php script i used and to select the image from the db and i display the image in the web page with html using the initial line i gave which worked. <?php // this is the script to retrieve image from database, file name "showimage2.php include ("databaseconnect.php"); if(isset($_GET['id'])) { $id = mysql_real_escape_string($_GET['id']); $query = "SELECT image FROM color WHERE id='$id'"; $result = mysql_query($query,$con); $row = mysql_fetch_array($result); $imageData = $row["image"]; header("content-type :image/jpeg"); echo ($imageData); } else { echo "Error!"; } ?> <html> <td><img src="showimage2.php?id=5" title="tan" width="150"height="150"/></td> </html> I have started doing some reading on the initial advice you gave me for storing the images in folders..thanks
-
displaying images in a webpage using php
Yes i did upload the pictures to the database via an upload script, and used a query to select the image and display it onto the webpage. The html above is what i used - (as the tutor said I hard coded the images into the webpage which was wrong). I then used radio buttons so a selection can be made on the image with a label I guess what they wanted is "i could just upload an image and it would automatically be added to the page and be displayed without i guess coding it into the html.. is that even possible??
- displaying images in a webpage using php
-
-
-
displaying images in a webpage using php
Ok...a little background on my situation Just failed my bsc final project. I uploaded some images to the database using a php script and it worked and the images were displayed in the web page perfectly... unfortunately the lecturers said i hard code the image into the html in a form to get it displayed an that was wrong for adding additional pictures. the following script i used in the html below and it worked. <td><img src="showimage2.php?id=5" title="tan" width="150"height="150"/></td> Is there another way to use php to add images to a web page for it to be displayed automatically somehow? Can someone provide a link or advice thanks
- Hi
- Hi