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


  $date= $_POST['date'];

  $query="SELECT shift_id  FROM shift WHERE shift_no='$shift_num' AND date='$date'";
  if ($result)
  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

Remove the asterisk, bye :)

now this is the error how can i remove it

now this is the error
Column 'shift_id' in where clause is ambiguous

Do you have shift_id in both tables molding_section and intermediate_store? If yes, you need to change the where clause to: WHERE molding_section.shift_id='$shift_id' AND intermediate_store.shift_id='$shift_id'