Jump to content

umm fetch rows from multiple tables


desithugg

Recommended Posts

umm what i want to do is fetch rows from multiple tables in 1 qury i want to this because im making a Forum..
well this is what i have
[code]<table width='100%' border='0' class='border'>
<tr>
<td width='20%' class='nav'>Poster</td>
<td width='60%' class='nav'>Post</td>
<td width='20%' class='nav'>Options</td>
</tr></table>
<table width='100%' border='0' class='border'>
<?php
$link = mysql_connect('localhost', '1135394704283249', '0309192909121845');
if (!$link) {
   die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('tpf');
if (!$db_selected) {
   die('Could not select database: ' . mysql_error());
}
$query = "SELECT author,post,id FROM post where thread_id = '$thread_id' ORDER BY id ASC limit $start,15";


$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_array($result)){$count++;
echo "<tr><td width='20%' class='nav2' height='130'>". $row['author'] ."</td><td width='60%' class='nav2'>". $row['post'] ."</td><td width='20%' class='nav2'><a href='index.php?action=editpost&post_id=". $row['id'] ."'>Edit</a><br><a href='index.php?action=deletepost&post_id=". $row['id'] ."'>Delete</a></td>";
}
?>
</table>
[/code]

well what that does is just get the Post,Author and displays it in a table.What i need it to do is use that author and get other information of the author from other tables like his Id# and maybe Email address etc.. amd display it under the author.
is this possiable if so can som1 help me im not so good with mysql..And btw.. i need it do that for all the authors/posts so yeah..Need some help with that
Link to comment
Share on other sites

[quote author=fenway link=topic=100793.msg398250#msg398250 date=1153071188]
Agreed.. it's impossible to us to suggest a join with the relevant table definitions.
[/quote]

umm i cant get it right

what right now it just gets the posts from the post table.
example
<table border='1' width='500'>
<tr>
<td>Author</td>
<td>Post</td>
<td>Id</td>
</tr>
<tr>
<td>Desithugg</td>
<td>Hello..Welcome to the Forums<br>enjoy your stay</td>
<td>1</td>
</tr>
<tr>
<td>Dusty</td>
<td>O hello.Ty for the welcome. :)</td>
<td>2</td>
</tr>
</table>
and displayes it but i also want it to use the author and get the row "Signtaure" from the "signup" table.and display it also and i want it to do it for each post
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.