p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > PHP/MySQL > Beginning PHP
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 29th, 2004, 01:50 PM
Authorized User
Points: 99, Level: 1
Points: 99, Level: 1 Points: 99, Level: 1 Points: 99, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2003
Location: , , .
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old January 29th, 2004, 03:07 PM
sal sal is offline
Friend of Wrox
Points: 1,413, Level: 15
Points: 1,413, Level: 15 Points: 1,413, Level: 15 Points: 1,413, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2003
Location: Clarksville, TN, USA.
Posts: 702
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old January 29th, 2004, 07:18 PM
Friend of Wrox
Points: 1,708, Level: 16
Points: 1,708, Level: 16 Points: 1,708, Level: 16 Points: 1,708, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: San Diego, CA, USA.
Posts: 833
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL statement that includes LEFT & RIGHT JOIN in callagga SQL Language 13 June 9th, 2008 03:30 AM
find multiple values from a table field raaj Beginning PHP 0 September 17th, 2007 04:51 AM
Crystal Report & VB6 & SQL Server wlho VB How-To 1 February 1st, 2005 07:05 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM
update table (SQL & DataSet) melvik ADO.NET 1 July 24th, 2003 05:40 PM



All times are GMT -4. The time now is 12:09 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc