Hey guys,
I am trying to change the values in one column of one table based
on the value in a different table. So far this is what i have. I am
only able to change the value based on a preset value i put into this
script. If anyone knows how I can set **value in another table** It
would be greatly appreciated.
Thanks
Bill
<?php
$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);
?>
|
|
0
|
|
|
|
Reply
|
BillinBoston (1)
|
3/26/2007 11:36:39 PM |
|
On 27 Mar, 00:36, "BillinBoston" <BillinBos...@gmail.com> wrote:
> Hey guys,
> I am trying to change the values in one column of one table based
> on the value in a different table. So far this is what i have. I am
> only able to change the value based on a preset value i put into this
> script. If anyone knows how I can set **value in another table** It
> would be greatly appreciated.
>
> Thanks
>
> Bill
> <?php
> $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);
> ?>
There is an example of this in a special book that we call "The
Manual".
Here: http://dev.mysql.com/doc/refman/5.0/en/update.html
UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;
|
|
0
|
|
|
|
Reply
|
Captain
|
3/27/2007 8:34:19 AM
|
|