neiltaylormade Posted June 22, 2007 Share Posted June 22, 2007 I dont understand whats going wrong on this script, using this script displays the orderID on the page, but as soon as I try to include any other elements from the table they dont show, and I cant work out why. <? // You may copy this PHP section to the top of file which needs to access after login. session_start(); // Use session variable on this page. This function must put on the top of page. if(!session_is_registered("userLogin")){ // if session variable "username" does not exist. header("location:../index.php"); // Re-direct to index.php } ?><?php require_once('../connections/conn.php'); ?> <?php mysql_select_db($database_conn, $conn); $query=("SELECT o.orderID orderID, c.clientTitle Title, c.clientForename Forename, c.clientSurname Surname, c.clientPhone Phone, c.clientEmail Email, ba.address1 BillingAddress1, ba.address2 BillingAddress2, ba.addressCity BillingCity, ba.addressPostcode BillingPostcode, bc.countryName BillingCountry, da.address1 DeliveryAddress1, da.address2 DeliveryAddress2, da.addressCity DeliveryCity, da.addressPostcode DeliveryPostcode, dc.countryName DeliveryCountry, op.productName ProductName, op.productQuantity ProductQuantity, op.productPrice ProductPrice, op.productSubtotal ProductSubtotal, o.orderTotal OrderTotal, op.imageID ImageID, op.imageThumb ImageThumb, o.userLogin userLogin FROM cmsOrders o LEFT JOIN cmsClients c ON c.clientID = o.orderClient LEFT JOIN cmsAddresses ba ON ba.addressID = o.orderBilling LEFT JOIN cmsAddresses da ON da.addressID = o.orderDelivery LEFT JOIN cmsCountries bc ON bc.countryValue = ba.addressCountry LEFT JOIN cmsCountries dc ON dc.countryValue = da.addressCountry LEFT JOIN cmsOrderProducts op ON op.orderID = o.orderID WHERE o.orderID = '" . addslashes($_GET['orderID']) . "' AND o.userLogin = '" . ($_SESSION['userLogin']) . "'"); $result=mysql_query($query); $num=mysql_numrows($result); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Admin - Shop - Order <?php echo $orderID; ?></title> <link href="../functions/site.css" rel="stylesheet" type="text/css" /> </head> <body> <h1><a href="../home.php">Website Management</a> > <a href="index.php">Shop</a> > <a href="orders.php">Orders</a> > Order <?php echo $orderID; ?></h1> <table width="100%" border="1" cellspacing="0" cellpadding="0"> <tr> <td width="50%" bordercolor="#666699"><table width="100%" border="0" cellspacing="2" cellpadding="0"> <tr> <td>Client Name: </td> <td><?php echo $Title; ?> <?php echo $Forename; ?> <?php echo $Surname; ?></td> <td> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> </tr> <tr> <td> </td> <td colspan="2"> </td> </tr> </table></td> <td width="50%" rowspan="2" bordercolor="#666699"> </td> </tr> <tr> <td bordercolor="#666699"> </td> </tr> </table> <p> </p> <p><a href="../index.php">Logout</a></p> </body> </html> If I insert the SQL statement into my sql viewer, it brings up the table nicely and with my named table headings, I really dont get why they are not displaying on my page. Any help will be much appreciated. Thanks Neil Quote Link to comment Share on other sites More sharing options...
SycoSyco Posted June 22, 2007 Share Posted June 22, 2007 youre not doing anything with your result. I'm guessing orderid is coming from somwhere else by accident. try adding $row=mysql_fetch_assoc($result); after $result=mysql_query($query); then echo $row['Surname']; Quote Link to comment Share on other sites More sharing options...
Caesar Posted June 22, 2007 Share Posted June 22, 2007 Where in your code are you assigning values to those variables? ($Title, $Forename, $Surname) Quote Link to comment Share on other sites More sharing options...
neiltaylormade Posted June 22, 2007 Author Share Posted June 22, 2007 Thank you so much, and for such a quick reply too. I think I'm trying to be too clever for my own good, used to use dreamweaver to do it all for me, i.e. recordsets, but trying to teach myself a better way of doing things! Thanks again 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.