Jump to content

Recommended Posts

  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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.