High_-_Tek Posted March 13, 2006 Share Posted March 13, 2006 Hey Hey Ya'll,I have written a 'confirm shipped' script for a company and even though I KNOW there is more than 1 row that should be returning...Yet it only returns one...Code:[code]<?phpsession_start();session_regenerate_id();include('connect.php');if (!$_SESSION['is_admin']){ header("Location: admin_login.php"); die(); }if ($_GET['orderid']){ $oid=$_GET['orderid'];}else{ $oid=$_POST['orderid'];}if (isset($_POST['submit'])){ if (isset($_POST['Y'])){ $sql=mysql_query("UPDATE Orders SET dispatched='1' WHERE Invoice_Number='$oid'"); echo "Thank You, The Order has Been Confirmed Shipped"; }else{ die('Stopped');}}$get=mysql_query("SELECT p.Name AS name, o.Subtotal AS sub, od.Price AS price, od.Quantity AS quan FROM Products AS p, Order_Details AS od, Orders as o WHERE o.Invoice_Number='$oid' AND o.Invoice_Number=od.Invoice_Number AND od.Product_ID=p.Product_ID") OR DIE (mysql_error());echo "<table border='.5'><tr><td><b>Product</b></td><td><b>Price</b></td><td><b>Quantity</b></td></tr>";while ($row=mysql_fetch_array($get)){ echo "<tr><td>{$row['name']}</td><td>{$row['price']}</td><td>{$row['quan']}</td></tr>";}echo "</table><br /><form method='POST' action=\"$PHP_SELF\"><b>Confirm?</b> <b>Yes:</b><input type='checkbox' name='Y'><br /<b>No:</b><input type='checkbox' name='N'><br /><input type='submit' name='submit' value='Confirm'><input type='hidden' name='orderid' value=\"$oid\"></form><br /><a href='ManagersMainMenu.php'>Main Menu</a>";?>[/code]SQL Schema:`Orders`Invoice_NumberCustomer_IDDate_OrderedDelivery_dateVATSubtotalmonthyeardispatched`Order_Details`Invoice_NumberProduct_IDPriceQuantityThank You :) Quote Link to comment Share on other sites More sharing options...
toplay Posted March 13, 2006 Share Posted March 13, 2006 Try the query in Mysql command prompt, myphpadmin or other similar tool first. Tweak it until it works and then place it in the PHP code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.