UNION Problem!
Posted: Mon Jun 07, 2004 1:07 pm
I am trying to select data from another table using UNION ALL SELECT but I seem to be getting continuous errors saying, You have an error in your SQL syntax near 'UNION ALL SELECT products FROM shopping_cart' at line 1. This is my code:
Does anyone see any errors in my code that could be repaired. Thanks!
Joe
Code: Select all
<?php
$sql = "UNION ALL SELECT products FROM shopping_cart";
$res = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($res))
{
$row = mysql_fetch_assoc($res);
echo $row['products'];
}Joe