Hi guys, I am currently studying MySQL and it is going great right now except I am stuck on the lesson about joining tables! They showed me an exercise that I am trying to do but for some reason it just will not work and I have the same exact code except for some changes! Here is my coding:
Now this is supposed to bring and join them together and then output them but for some reason it will not and so I get this error:PHP Code:
//Make MySQL Connection
mysql_connect ("localhost", "psrev_admin", "1admin") or die (mysql_error());
mysql_select_db ("psrev_test") or die (mysql_error());
//Construct our join query
$query = "SELECT family.position, food.meal".
"FROM family, food".
"WHERE family.position = food.position";
$result = mysql_query ($query) or die (mysql_error());
//Print out the contenst of each row into a table
while ($row = mysql_fetch_array($result))
echo $row['position'] . " - " . $row['meal'];
echo "<br />";
Now from the looks of it I seem to be getting the error from the lineYou have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.position = food.position' at line 1
Can anyone of you guys help me out please in understanding what is the issue! They have used capital P in Position and M in Meal while I put it small!!! But for the reason that that is how it is in my tables!!!$result = mysql_query ($query) or die (mysql_error());