I have been using the following query in a ticketing system for many years
[CODE]“select * from Callbacks where Callbacks.cartId = TicketsSold.OrderID and TicketsSold.MC_EventDate = ‘Fri 22nd Apr’ GROUP BY cartId”
And its always returned the necessary data, however now its telling me that [i]Unknown column ‘TicketsSold.OrderID’ in ‘where clause’
The data in the table is still the same as are the tables and their columns.
Can anyone advise what is incorrect about this please? I have tried adding ‘ around the table.column but that just returns no data
Many thanks for any help
Just to add to this….I have added the single quotes and it no longer errors, but I get on data. Below is my code to output the data:
[code]<!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>Attendance List Fri 22nd April 2011</title>
<?php
//we need to connect to the database so
require(‘db_connect.php’);
?>
<?php
$query = “select * from Callbacks where Callbacks.cartId = ‘TicketsSold.OrderID’ and ‘TicketsSold.MC_EventDate’ = ‘Fri 22nd Apr’ GROUP BY cartId”;
$results = mysql_query($query) or die(mysql_error());
?>
<style type=”text/css”>
<!–
.style1 {font-family: Verdana}
.style2 {font-family: Verdana; font-size: 13px; }
–>
</style>
</head>
<body>
<p class=”style1″><font size=”4″ face=”Tahoma”>Online Ticketing<b> <br />
Attendance List for :</b></font> Friday 22nd April 2011</p>
<p>
<title></title>
<hr /> <?php
while ($row = mysql_fetch_array($results)) {
extract($row);
echo “<table width=”100%” border=”0″>”;
echo “<tr>”;
echo “<td width=”17%”><span class=”style1 style36 style10″><strong>Ticket No </strong></span></td>”;
echo “<td width=”20%”><span class=”style1 style36 style10″><strong>Name</strong></span></td>”;
echo “<td width=”43%”><span class=”style1 style36 style10″><strong>Address</strong></span></td>”;
echo “<td width=”21%”><span class=”style1 style36 style10″><strong>Ticket Details </strong></span></td>”;
echo “</tr>”;
echo “<tr>”;
echo “<td valign=”top” class=”style2″>$cartId </td>”;
echo “<td valign=”top” class=”style2″>$customername</td>”;
echo “<td valign=”top” class=”style2″>$customeraddress</td>”;
echo “<td valign=”top” class=”style2″>$M_disc </td>”;
echo “</tr>”;
echo “</table>”;
echo “<hr>”;
}
?>
</p>
<p class=”style2″>End of List for this Date</p>
</body>
</html>