This is really weird... i have tried the same exact code in phpmyadmin and it 
works like a charm, but when i run the script... no errors then i go to 
phpmyadmin and nothing has changed :(

this is the code:
============================================================================
$how_many_to_update=count($cardno_array);

// update the cards status to sent
for($i=0;$i<$how_many_to_update;$i++)
{
$update_sql="update greetings set is_sent=1 where  
cardno='".$cardno_array[$i]."' and rand_str='".$rand_str_array[$i]."' LIMIT 1";

$result = mysql_query($sql_1);
$num_rows1 = mysql_num_rows($result);

    if(!$result || $num_rows1==0){echo "Error: unable to update sent 
greetings";exit;}
echo "updating<br>$update_sql<br>";
}
=========================================================================

In the second last line you can see i have an echo statement... the SQL thats 
outputted from there works perfectly in phpmyadmin...
any idea whats wrong?


Slightly OT, any better way to run the multiple updates needed above than 
instead of running the update query in a loop?
I searched google and the best i could find was the IN() for mySql... but that 
does not take 2 parameters (eg: cardno and rand_str) it would work just on 
card_no like this in('14','34')

Thanks!
R



      

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to