You need to put {} in the while function like this
while.... {
do this
}
$query = "SELECT name FROM users";
$ret = mysql_query($query);
while(list($name) = mysql_fetch_row($ret)) or die("Error: ".mysql_error()) {
print ("your name is $name);
$query_update["name"] = ("UPDATE my_other_table set name = $name");
$result = mysql_query($query_update["name"]);
or die("Error: ".mysql_error());
};
23/03/2002 20:58:14, "Jen Downey" <[EMAIL PROTECTED]> wrote:
>Hi all!
>
>Just wondering, If I have a query like:
>
>$query = "SELECT name FROM users";
>$ret = mysql_query($query);
>while(list($name) = mysql_fetch_row($ret)) or die("Error: ".mysql_error());
>print ("your name is $name);
>
>$query_update ["name"] = ("UPDATE my_other_table set name = $name");
>$result = mysql_query($query_update["name"]);
>or die("Error: ".mysql_error());
>
>Why wont this work?
>
>I am trying to select the user name from the user table and then update
>another table with that user name. But it doesn't seem to want to update the
>other table
>
>I get no errors when running the script.
>
>Thanks in advance
>Jennifer Downey
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-------- End of forwarded message --------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php