I need to build a query by concatenating two varibles, here is a snip of my code:
$howmany = How many times to loop, ie 5 times.
<?php
$i=0;
while ($i <= $howmany)
{
// create connection
$connection = mysql_connect("my_server","php_user","php_password")
or die("Couldn't make the friggin connection.");
// select database
$db = mysql_select_db("my_database", $connection)
or die("Couldn't select database.");
// create SQL statement
$sql = "update the_table set done ='P' where primary_number = $result.{$i}";
// execute SQL query and get result
$sql_result = mysql_query($sql,$connection)
or die("Couldn't execute the damned query.");
$i++;
}
?>
Essentially results are parsed over, Im not sure what the numbers will be, one time it maybe result0 with a value of '0012'.
Another time it may be result3 with a value of '9911', as well as result9 with a value of '10999'.
My point is I want to parse through result0-result 9999(not a set number) and where the data contained in result0 - result9999(again, not s set number) is equal to a valid primary_number (see code), I want the 'done' field set to 'P' for that record.
Currently that code above sets all the records to 'P'.
Im almost sure its a simple syntax error, but I have been unable to find it.
Thank you for your help.
Fim