View Single Post

   
  #2 (permalink)  
Old 02-28-2008, 10:29 AM
Captain Paralytic
 
Posts: n/a
Default Re: Trying to change column in table based on a value in another table

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;

Reply With Quote