0

I need to get information from 2 tables in the same mysql database

$sql = mysql_query("SELECT * FROM notes, customers WHERE `to`='next' LIMIT 5");

		  while($a = mysql_fetch_array($sql)){
		    
  		  $row_color = ($row_count % 2) ? "#EFEFEF" : "#FFFFFF";
		    
		  	echo("<tr bgcolor=\"$row_color\">
    <td height=\"25\">" . $a['custid'] . "</td>
    <td height=\"25\">" . $a['name'] . "</td>
    <td>" . $a['ebay'] . "</td>
	<td>" . $a['title'] . "</td>
	<td>" . $a['type'] . "</td>
</tr>");
		
			$row_count++;
		  }

The name and ebay fields are in the customer table and the rest are in the notes table. The code above doesnt produce any error just no rows are displayed

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by prethum
0

you cant query two tables aat once. Either do them one at a time or make a stored procedure. I don't know anything about mysql so I cant help with the stored procedure.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.