kevinkhan
03-30-2010, 09:26 AM
I have this piece of code that takes phone numbers from a table called phone_numbers but which the phone numbers aren't in a table called phone_numbers_sent. The code is working however it generates an error if there is no numbers in the phone _numbers_sent table...
Here is the code
@mysql_connect($config['dbhost'], $config['dbuser'], $config['dbpass']) or die(mysql_error());
@mysql_select_db($config['dbname']) or die(mysql_error());
//define phone list array
$phone_list = array();
$send = mysql_query("select `phone` from phone_number_sent");
$sent = array();
while($r = mysql_fetch_assoc($send)){
$sent[]="'".$r['phone']."'";
// echo $r['phone'];
}
// print_r($sent);
$sent = implode(",",$sent);
//echo $sent;
$to_send = mysql_query("select * from phone_number where phone NOT IN({$sent})");
while($row = mysql_fetch_assoc($to_send)){
// echo $row['phone'];
$phone_list[] = array($row['phone'], $row['source']);
// print_r($phone_list);
}
can any body help me figure out the code for this
Thanks
Here is the code
@mysql_connect($config['dbhost'], $config['dbuser'], $config['dbpass']) or die(mysql_error());
@mysql_select_db($config['dbname']) or die(mysql_error());
//define phone list array
$phone_list = array();
$send = mysql_query("select `phone` from phone_number_sent");
$sent = array();
while($r = mysql_fetch_assoc($send)){
$sent[]="'".$r['phone']."'";
// echo $r['phone'];
}
// print_r($sent);
$sent = implode(",",$sent);
//echo $sent;
$to_send = mysql_query("select * from phone_number where phone NOT IN({$sent})");
while($row = mysql_fetch_assoc($to_send)){
// echo $row['phone'];
$phone_list[] = array($row['phone'], $row['source']);
// print_r($phone_list);
}
can any body help me figure out the code for this
Thanks