English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am trying to update a table based on a mysql query of another table in the same database. I can use
$con = mysql_connect("server","database","%*&^(*&(*&");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("database", $con);


mysql_query("UPDATE data SET Column_name = 'Value'
WHERE column_name = **value in another table** ");


mysql_close($con);
?>

to change the value based on a set value i put in the code. But does anyone know what I should do to get the value to be based on a query of another table?

thanks

2007-03-26 12:34:00 · 2 answers · asked by billinfenway 1 in Computers & Internet Programming & Design

2 answers

Experiment and find out.

Without my experimenting I do not see why not as long as the value selection returns only one value.

It is common in my work to load a test table from production using syntax such as: insert into table_x (select * from table_x@prod_db);

2007-03-26 17:21:49 · answer #1 · answered by Wi-Skier 4 · 0 0

Wouldn't you just put the value of the other table? Maybe you should explain more.

2007-03-29 14:11:44 · answer #2 · answered by justintimberfakesucks 1 · 0 0

fedest.com, questions and answers