Here is the query PHP: $sql_inventory = mysql_query("SELECT `id`,`name`,`description`,`cat`,`subcat`,`owner`,`qty` FROM `inventory` INNER JOIN `clients` ON `inventory`.`owner` = `clients`.`id` ORDER BY `clients`.`name` ASC") or die("query fail : ". mysql_error()); PHP keeps coming back with "Column 'id' in field list is ambiguous" is there any easy fix to this that doesnt require me to rename columns in the database? Please help, im kind of in a time crunch. thanks guys
Code: $sql_inventory = mysql_query("SELECT `inventory`.`id`,`inventory`.`name`,`inventory`.`description`,`inventory`.`cat`,`inventory`.`subcat`,`inventory`.`owner`,`inventory`.`qty` FROM `inventory` INNER JOIN `clients` ON `inventory`.`owner` = `clients`.`id` ORDER BY `clients`.`name` ASC") or die("query fail : ". mysql_error());
if i could i would hug you RTT i thought the FROM `inventory` would have made that clear to MySQL but i was wrong THANK YOU THANK YOU THANK YOU
You need to specify which table you want id from inventory.id or clients.id rather than just id, probably the same with the rest of the fields. Code: SELECT inventory.id, ..... or Code: SELECT clients.id, ..... If both tables have a field with the same name and you want both you will need to use AS Code: SELECT inventory.id AS invid, clients.id AS clientid edit: bah to slow
You'd think so but there are some good reasons why that doesn't make it clear to MySQL. You'd have to dig into some pretty hefty theory though