|
|
 |
| Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Beginning PHP section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

January 29th, 2004, 01:50 PM
|
|
Authorized User
|
|
Join Date: Oct 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sql & join tables & find a field in multiple table
Hi folks,
I'm trying to search for a link in multiple tables in my database and update that link on the web form at once if found. I have trouble with the logic of running through all the tables to find and display it on the form. Would you please guide me how to do it!
table 1:
field name data
*****************************
bookType history
location aaa
bookName American history
id 1
link http://www.yahoo.com
table 2:
/////////////////////////////////////////////////
field name data
******************************************
bookType history
location bbbbb
bookName Mexican history
id 2
link http://www.yahoo.com
/////////////////////////////////////////////////////////////////////
Thanks so much
td
|

January 29th, 2004, 03:07 PM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Do a union query to return all rows from all tables containing that link, the primary key to the table and a calculated field with the table name. Then use that result set to update your tables with a loop.
Sal
|

January 29th, 2004, 07:18 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: San Diego, CA, USA.
Posts: 833
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I guess a union query would work, but I can't help but ask, WHY why WHY WHY Why whY WHY do you have two separate tables that store the same type of data?
Take care,
Nik
http://www.bigaction.org/
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |