r-it Posted May 19, 2008 Share Posted May 19, 2008 i have a problem i would like some help with, i need to read data from 2/3 tables that i queried with one select statement, let me give you an example: $sql = $conn->query("SELECT v.name, v.surname, v.idnum, c.clientID, s.detail FROM voice v, client c, supplier s WHERE v.clientID = c.clientID, c.clientID = s.clientID"); if($mysql_num_rows($sql) > 0) { while($a = $conn->fetchArray($sql)) { $name = $a['v.name']; $surname = $a['v.surname']; $id = $a['v.idnum']; $clid = $a['clientID']; $dtl = $a['detail']; }//end of while }//end of mysqlnumrows if the thing is that i get an error when i do something like this, i have done it before, it's just that i have so much scripts that i can't remember where i use it, as i hardly have a need to link tables, please help if you know where the problem is. Link to comment https://forums.phpfreaks.com/topic/106306-getting-data-from-multiple-tables-mysql-php/ Share on other sites More sharing options...
nadeemshafi9 Posted May 19, 2008 Share Posted May 19, 2008 $sql = $conn->query("SELECT v.name, v.surname, v.idnum, c.clientID, s.detail FROM voice v, client c, supplier s WHERE v.clientID = c.clientID AND c.clientID = s.clientID"); why r u joining s when u dont select anything from s Link to comment https://forums.phpfreaks.com/topic/106306-getting-data-from-multiple-tables-mysql-php/#findComment-544804 Share on other sites More sharing options...
BlueSkyIS Posted May 19, 2008 Share Posted May 19, 2008 $sql = $conn->query("SELECT v.name, v.surname, v.idnum, c.clientID, s.detail FROM voice v, client c, supplier s WHERE v.clientID = c.clientID AND c.clientID = s.clientID"); why r u joining s when u dont select anything from s s.detail ??? Link to comment https://forums.phpfreaks.com/topic/106306-getting-data-from-multiple-tables-mysql-php/#findComment-544819 Share on other sites More sharing options...
nadeemshafi9 Posted May 19, 2008 Share Posted May 19, 2008 did u try what i said Link to comment https://forums.phpfreaks.com/topic/106306-getting-data-from-multiple-tables-mysql-php/#findComment-544856 Share on other sites More sharing options...
r-it Posted May 19, 2008 Author Share Posted May 19, 2008 i am selecting something from s, that's s.detail i'm looking at a way to retrieve the values Link to comment https://forums.phpfreaks.com/topic/106306-getting-data-from-multiple-tables-mysql-php/#findComment-544869 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.