Hallo Anantha

Join 3 Tables On MySQL

Posted on: August 17, 2007

This Article have been moved at Show Data with Join 3 Tables MySQL

10 Responses to "Join 3 Tables On MySQL"

good help

i need a support on how to join 3 to four tables in a database using mysql select but it keeps repeating 1 no throughout..i need the query to do that..like am joining these four tables together now
account payment,account trxn,savings_trxn_details and the relationship among them is the account id but one of them does not have the account id and i want the details on the other to appear on the same table with them..
thanks
andrew

wow,.. great post I should say. Was looking for join and after reading your post and add in some join with your left join, my sql are working!

Again, Thanks = )

Oh, you are the man! It took me a while to google if 3 joins were even possible!

Thanks!!!!!

Thank you so much!! It works for 4 tables too🙂

[quote]
$sql=mysql_query(“SELECT title_post, post, id_category, id_topic FROM posting_forum
LEFT JOIN topic_forum ON posting_forum.id_topic = topic_forum.id_topic
LEFT JOIN category_forum ON posting_forum.id_category = category_forum.id_category ORDER BY id_post”);

$x=mysql_fetch_array($sql);

echo “Topik: $x[title_topic]”;
echo “”;
echo “Intro: $x[intro]”;
echo “”;
echo “Category: $x[title_category]”;
echo “”;
echo “Title: $x[title_posting]”;
echo “”;
echo “Post: $x[post]”;
[/quote]

My DataBase:

tbl>1 posting_forum

id_post
id_category
id_topic
title_posting
post

tbl>2 category_forum

id_category
title_category

tbl>3 topic_forum

id_topic
title_topic
intro

———————————————————————————-
I have an error in result :

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\work\showpost.php on line 8

I also rename the fetch_array function to num_rows but still got the same error. Please help me wats wrong with my query or script?

Thank for the help….

I`m sorry, the error was only title_post and post that showed up on the browser. But the title_topic, intro and title_category was blank. Something wrong with my query???

I`m very sorry about the error….

The error was not:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\work\showpost.php on line 8

I need to write a query which get array of data from one table and then search in second table at basis of result..Please help me..I can forward my code its only return me one record and search that one rec in second table ..I wanna get more then one rec Please Please Please help me out..

thank, is ok,..is very imfortan for me..

I’m really enjoying the design and layout of your blog.
It’s a very easy on the eyes which makes it much more pleasant
for me to come here and visit more often. Did you hire out a
designer to create your theme? Great work!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Pages

August 2007
M T W T F S S
    Sep »
 12345
6789101112
13141516171819
20212223242526
2728293031  

My !Yahoo

BLUPAPER.com

Community

Amateur Radio Club ITB

Balikpapan blogger


KampungBlog.com - Kumpulan Blog-Blog
Indonesia
Personal blogs

Peta-Pengunjung

RSS ComputerWorld

  • An error has occurred; the feed is probably down. Try again later.

RSS NetworkWorld

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoWorld

  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: