paulm2003 Posted November 27, 2003 Share Posted November 27, 2003 Trying to write a contribution I was testing some MySQL, when I make the following simple query (from a book example): //connect to DB $link = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die (mysql_error()); mysql_select_db(DB_DATABASE) or die (mysql_error()); $sql = 'SELECT manufacturers.*, products.*'; $sql .= 'FROM manufacturers, products'; $sql .= 'WHERE manufacturers.manufacturers_id = products.manufacturers_id'; $result = mysql_query($sql) or die(mysql_error()); it works fine using PHP MyAdmin, but using a PHP script I get the next error Not unique table/alias: 'manufacturers' :huh: any suggestions? Link to comment Share on other sites More sharing options...
paulm2003 Posted December 8, 2003 Author Share Posted December 8, 2003 Already found the answer at another board, something like this: //connect to DB $link = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die (mysql_error()); mysql_select_db(DB_DATABASE) or die (mysql_error()); $sql = 'SELECT manufacturers.*, products.* FROM manufacturers, products WHERE manufacturers.manufacturers_id = products.manufacturers_id'; $result = mysql_query($sql) or die(mysql_error()); should work fine. I copy and pasted the code and didn't notice there where some spaces missing :rolleyes: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.