Jump to content

getting data from multiple tables mysql php


r-it

Recommended Posts

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.