We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,301 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

HELP PLZ - with joining tables

hey guys.. i have trying for 2 weeks now to connect 2 tables
in the way that i need them to print out..

to understand the table structure please see attachment 001

Now... i have managed to join both table but the problem is that each time i insert a new recipe in creates a new completley seperate table and i want all the recipes that belong to "some recipe website" to apear in the same table of the right recipe website.

to understand my problem please see atachment 002

in attachment 002 its also clear to see i need to also show empty recipe websites meaning ones i have yet to submit to otherwise it would easily done with one table and no mass :)

I hope i didnt drove you mad about attachment.. just tought it would be easier to explain that way..

Really need some help here guys so plz (if you can) take a second to help me

Attachments 001.jpg 22.86KB 002.jpg 31.91KB
3
Contributors
6
Replies
2 Days
Discussion Span
1 Year Ago
Last Updated
7
Views
sagive
Junior Poster in Training
87 posts since Dec 2009
Reputation Points: 34
Solved Threads: 8
Skill Endorsements: 0

Insertion is the problem or you are not able to display things in expected way???

each time i insert a new recipe in creates a new completley seperate table and i want all the recipes that belong to "some recipe website" to apear in the same table of the right recipe website.

Also I do not understand your above statement. What do you mean by "creates a new completely separate table"?

urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

sorry - i mean every insertion creates a new raw.. the data is entered into the database using a form and that part works great..

My problem is displaying the data correctly.. (view attachment 02)

sagive
Junior Poster in Training
87 posts since Dec 2009
Reputation Points: 34
Solved Threads: 8
Skill Endorsements: 0

Show the sql statements you are using.

smantscheff
Nearly a Posting Virtuoso
1,297 posts since Oct 2010
Reputation Points: 321
Solved Threads: 270
Skill Endorsements: 8

g'eez... my select statement doesetn work well as i explained in attachment 02..
those are only 2 lines of code so i am hopeing to start fresh... with a clean way of thinking of it..

sagive
Junior Poster in Training
87 posts since Dec 2009
Reputation Points: 34
Solved Threads: 8
Skill Endorsements: 0

This is not compiled code, change column name and others syntax.

<?PHP
$query="select websitename,websitelink from receipe_sites order by websiterank desc";

$web=mysql_query($query);
echo "\n<table>";

while($rowweb=mysql_fetch_assoc($web))
{

   $query="select recipeid,recipename, reciepelink, recipeby from receipe_submit where websitename='{$rowweb['websitename']}' order by websiterank desc";

   $rec=mysql_query($query);

   echo "\n<tr><td><b>{$rowweb['websitename']}</b></td></tr>";

   echo "\n<tr>";
   echo "<td>Name</td>";
   echo "<td>Link</td>";
   echo "<td>By</td>";
   echo "</tr>";

   while($rowrec=mysql_fetch_assoc($rec))
   {
      echo "\n<tr>";
      echo "<td>{$rowrec['recipename']}</td>";
      echo "<td>{$rowrec['recipelink']}</td>";
      echo "<td>{$rowrec['recipeby']}</td>";
      echo "</tr>";

   }

   echo "\n<tr><td><b>&nbsp</td></tr>";
}


?>
urtrivedi
Posting Virtuoso
1,714 posts since Dec 2008
Reputation Points: 299
Solved Threads: 362
Skill Endorsements: 24

wow, thanks a lot for your answer.. going to try it now :)

sagive
Junior Poster in Training
87 posts since Dec 2009
Reputation Points: 34
Solved Threads: 8
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0903 seconds using 2.68MB