hi m using php n mysql
m trying to merge two tables of same database and then print them but somehow it is not working
it gives me the error
my code is
<?php
session_start();
print_r($_POST);
$con=mysql_connect("localhost","root","");
mysql_select_db("pras2",$con);
$date= $_POST['date'];
$shift_num=$_POST['num'];
$query="SELECT shift_id FROM shift WHERE shift_no='$shift_num' AND date='$date'";
$result=mysql_query($query);
if ($result)
{
$row=mysql_fetch_assoc($result);
$shift_id=$row['shift_id'];
echo $shift_id;
}
$query1="SELECT *molding_section.machine_name, intermediate_store.product FROM molding_section, intermediate_store
WHERE shift_id='$shift_id'";
$result1=mysql_query($query1) or die(mysql_error());
if ($result1)
{
while ($get_info = mysql_fetch_row($result1))
{
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td>$field</td>\n";
print "</tr>\n";
}
}
?>
and error is
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'molding_section.machine_name, intermediate_store.product FROM molding_section, ' at line 1
but i cannot figure out the error