Re: Select then update
| From: | Alberto Wagner | Date: | Sat, 30 Mar 2002 02:03:45 +0000 |
| Subject: | Re: Select then update | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89863@lists.php.net to get a copy of this message | ||
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" <jendowney@attbi.com> 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 --------