Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-26-2002, 03:12 AM   PM User | #1
vixtran
New Coder

 
Join Date: Oct 2002
Location: USA
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
vixtran is an unknown quantity at this point
calling from-1 database, 2 tables

U guys are great! thanks for all your help here

OK, what if I want to call from 1 database, from 2 fields in 2 diff tables?

how would i select them?

for php output.. I got calling one down from one table..but now from 2 diff tables

thanks again
vixtran is offline   Reply With Quote
Old 10-26-2002, 07:50 AM   PM User | #2
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
http://sqlcourse2.com/joins.html
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 10-26-2002, 03:23 PM   PM User | #3
vixtran
New Coder

 
Join Date: Oct 2002
Location: USA
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
vixtran is an unknown quantity at this point
thanks guys/girls, you are extremely beneficial to the community. That was a great site, and extremely helpful. The problem I have is just not know what the variables, and stuff are actually called..So it is hard to search through a million pages on the web looking. THANKS AGAIN !!!
vixtran is offline   Reply With Quote
Old 10-26-2002, 05:44 PM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Well you need to provide us with more than just talking about it otherwise we can't help. Right now all I can do is say the same thing you can find in that tutorial I posted:

SELECT table1.field1, table2.field1 FROM table1, table2 WHERE where condition here;
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 10-26-2002, 11:44 PM   PM User | #5
vixtran
New Coder

 
Join Date: Oct 2002
Location: USA
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
vixtran is an unknown quantity at this point
lol am sorry . I will think of that next time, but it wont go :-( I am missing something

<?
$db_name = "user_mapforum";
$table_name = "ibf_post";
$table_name2 = "ibf_topics";
$connection = @mysql_connect("localhost", "user name", "pass") or die("Couldn't Connect.");
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select database.");
$sql = "SELECT ibf_posts.ibf_posts, ibf_topics.title FROM $table_name, $table_name2
WHERE ibf_topics.title = ibf_posts.post_date";
$result = @mysql_query($sql, $connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
$ibf_topics = $row['ibf_topics'];
$ibf_posts = $row['ibf_posts'];
$display_title .= "<p><strong>$ibf_topics</strong></p>";
$display_post .= "<p><strong>$ibf_posts</strong></p>";
}
?>

I keep getting couldnt execute query..I think ..well I am missing something..I am calling with echo command on another page using the $display

ohh well I hope people can sort through that mess. thanks
vixtran is offline   Reply With Quote
Old 10-28-2002, 02:33 PM   PM User | #6
vixtran
New Coder

 
Join Date: Oct 2002
Location: USA
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
vixtran is an unknown quantity at this point
Umm Im lost hellp lol, I still can not figure where my error is
vixtran is offline   Reply With Quote
Old 10-28-2002, 03:44 PM   PM User | #7
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,220
Thanks: 4
Thanked 80 Times in 79 Posts
Spookster will become famous soon enough
Try hardcoding your table names in first. If the query cannot find the tables then that will stop it from running.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 01:23 PM.


Advertisement
Log in to turn off these ads.