Kahuki Webmaster Forum and Discussion Community  

Go Back   Kahuki Webmaster Forum and Discussion Community > Website Development & Management > Programming > PHP



Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-27-2007, 12:34 AM
blackfox's Avatar
Member
 
Join Date: Dec 2006
Posts: 65
blackfox is on a distinguished road
How to Update MYSQL database table based on mysql query array?

I am trying to update a table based on a mysql query of another table in the same database. I can use
<?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);
?>

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

Reply With Quote
  #2 (permalink)  
Old 03-27-2007, 05:21 AM
Rookie
 
Join Date: Jan 2007
Posts: 8
jain_manu is on a distinguished road
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);

Reply With Quote
  #3 (permalink)  
Old 03-30-2007, 02:11 AM
Member
 
Join Date: Mar 2007
Posts: 51
natalykorah is on a distinguished road
Wouldn't you just put the value of the other table? Maybe you should explain more.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to upload mySQL database to my webhost? At my machine, mySQL uses innodb engine, which is disabled on host Schlase PHP 2 05-25-2007 03:37 PM
MySQL Query - use every table except this, this and this!? Shnurok PHP 2 03-16-2007 05:38 PM
what does this mean-"mysql connection error: Lost connection to MySQL server during query "? Kedar PHP 2 02-20-2007 03:36 PM
MYSQL query - multiple COUNT in one query? Tobi PHP 2 09-06-2006 02:22 PM
How to access MYSQL database Using PHP in Linux and how to configure Mysql and php for Apache in linux? passi PHP 1 03-07-2006 01:12 PM


All times are GMT. The time now is 09:46 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0