highaspen Posted August 13, 2007 Share Posted August 13, 2007 I've seen this done before and I think I've done it... hewre is waht I've got and the output only populates the variables from the first query and seems to ignore the second query. I've checked my data and I should have some values here in the second query. Any help would be appreciated. --------------- $conn=@mysql_connect("localhost", "$dbuser","$dbpass") or die("Could not connect". mysql_error()); $rs = @mysql_select_db($db, $conn) or die("Could not select database". mysql_error()); $sql="SELECT * FROM reminders WHERE dom='$today' AND timehour='$thishour' AND timeminute='$thisminute' AND active='yes'"; $rs=mysql_query($sql,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs) ) { $callname = $row['name']; $callid = $row['callid']; $timehour = $row['timehour']; $timeminute = $row['timeminute']; $meridian = $row['meridian']; $callinno = $row['callinno']; $passcode = $row['passcode']; $locationname = $row['locationname']; $locationaddress = $row['locationaddress']; $locationcity = $row['locationcity']; $locationstate = $row['locationstate']; $locationcountry = $row['locationcountry']; $sql2="SELECT * FROM xocai WHERE active='yes' AND call1='$callid' OR call2='$callid' OR call3='$callid' OR call4='$callid' OR call5='$callid' OR call6='$callid' OR call7='$callid' OR call8='$callid' OR call9='$callid' OR call10='$callid'"; $rs=mysql_query($sql2,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs) ) { $list .="$firstname = ".$row2["firstname"]." $address = ".$row["areacode"]."".$row["prefix"]."".$row["suffix"]."".$row["carrier"].""; echo ($list); if (!$list ) echo("busted"); } } Link to comment https://forums.phpfreaks.com/topic/64751-mysql-query-inside-a-query/ Share on other sites More sharing options...
MadTechie Posted August 13, 2007 Share Posted August 13, 2007 try this <?php $conn=@mysql_connect("localhost", "$dbuser","$dbpass") or die("Could not connect". mysql_error()); $rs = @mysql_select_db($db, $conn) or die("Could not select database". mysql_error()); $sql="SELECT * FROM reminders WHERE dom='$today' AND timehour='$thishour' AND timeminute='$thisminute' AND active='yes'"; $rs1=mysql_query($sql,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs1) ) { $callname = $row['name']; $callid = $row['callid']; $timehour = $row['timehour']; $timeminute = $row['timeminute']; $meridian = $row['meridian']; $callinno = $row['callinno']; $passcode = $row['passcode']; $locationname = $row['locationname']; $locationaddress = $row['locationaddress']; $locationcity = $row['locationcity']; $locationstate = $row['locationstate']; $locationcountry = $row['locationcountry']; $sql2="SELECT * FROM xocai WHERE active='yes' AND call1='$callid' OR call2='$callid' OR call3='$callid' OR call4='$callid' OR call5='$callid' OR call6='$callid' OR call7='$callid' OR call8='$callid' OR call9='$callid' OR call10='$callid'"; $rs2=mysql_query($sql2,$conn) or die("Could not execute query". mysql_error()); while($row= mysql_fetch_array($rs2) ) { $list .="$firstname = ".$row2["firstname"]." $address = ".$row["areacode"]."".$row["prefix"]."".$row["suffix"]."".$row["carrier"].""; echo ($list); if (!$list ) echo("busted"); } } ?> added $rs1 $rs2 Link to comment https://forums.phpfreaks.com/topic/64751-mysql-query-inside-a-query/#findComment-322969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.