Forum Moderators: coopster
Code in question:
$sql = "SELECT * FROM current_members, search_level, search_types, contract_style, members_specialties WHERE item == '$item' AND username = '$username'";
$rec = mysql_query($sql);
while($row = mysql_fetch_assoc($rec))
When I use only one table this works fine. As soon as I add the other tables it errors:
mysql_fetch_row(): supplied argument is not a valid MySQL result resource
I am trying to post information about all members to a Web page from multiple tables. $item and $username are the same in each table for each member. Should this work or am I way off?
Thanks
This means that your query is failing and my guess is that your statement is using a column name that is ambiguous,
itemand
usernameare columns that exist in all of your tables. If you fully qualify the column names with your primary table name, your query should execute as desired.
$sql = "SELECT * FROM current_members, search_level, search_types, contract_style, members_specialties WHERE current_members.item = '$item' AND current_members.username = '$username'";