The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
untitled PHP Code
Posted by: wakawaka | August 9, 2010 @ 2:38am
PHP Code
[
Download
]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Your Order</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); ?> <?php $oid = "8"; $sql = "SELECT * FROM orders WHERE orderid=$oid"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $production=$row['products']; $productss = explode("+", $production); $quantity=$row['quantity']; $quantities = explode("+", $quantity); ?> <table width="212" height="56" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="108" height="19">Product</td> <td width="19"> </td> <td width="85" height="19">Quantity</td> </tr> <tr> <td height="18"><?php for($i = 0; $i < count($productss); $i++){ $sql = "SELECT * FROM products"; $query = mysql_query($sql); while($row = mysql_fetch_array($query)) { $prodid=$row['productid']; $prodname=$row['productname']; $prodprice=$row['price']; if ($productss[$i]=$prodid){ echo $prodname; echo " "; echo $prodprice; echo " "; echo " "; echo "<br />"; } //end the if for($i=0; $i < count($prodid);){ $totalprice+=$prodprice[$i]*$quantities[$i]; $i++; } }//ends the while ?></td> <td bgcolor="#CCCCCC"></td> <td><div align="right"> <?php echo "<br />"; for($i = 0; $i < count($quantities); $i++){ echo $quantities[$i]; echo " "; echo "<br />"; }//end the for ?> </div></td> </tr> <tr> <td height="19">Total Price </td> <td>$</td> <td><?php echo $totalprice; ?></td> </tr> </table> <p> <?php }//end the first for loop } ?> </p> <p> </p> <p> </p> <p> </p> </body> </html>
Syntax Highlighting
[
Open in new window
]
Author Comments
none
Rating
4.17 / 8
40 Votes
http://codebin.yi.org/779
page generated in 0.01 seconds