Jump to content

[SOLVED] MySQL include


neiltaylormade

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/56782-solved-mysql-include/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.