desithugg Posted July 16, 2006 Share Posted July 16, 2006 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 https://forums.phpfreaks.com/topic/14774-umm-fetch-rows-from-multiple-tables/ Share on other sites More sharing options...
AndyB Posted July 16, 2006 Share Posted July 16, 2006 You need a 'join' (to join the tables for a single query).It's less complicated than it sounds. http://htmlite.com/mysql012.php has simple examples that should get you on your way. Link to comment https://forums.phpfreaks.com/topic/14774-umm-fetch-rows-from-multiple-tables/#findComment-58995 Share on other sites More sharing options...
fenway Posted July 16, 2006 Share Posted July 16, 2006 Agreed.. it's impossible to us to suggest a join with the relevant table definitions. Link to comment https://forums.phpfreaks.com/topic/14774-umm-fetch-rows-from-multiple-tables/#findComment-59014 Share on other sites More sharing options...
desithugg Posted July 17, 2006 Author Share Posted July 17, 2006 [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 rightwhat 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 https://forums.phpfreaks.com/topic/14774-umm-fetch-rows-from-multiple-tables/#findComment-59456 Share on other sites More sharing options...
fenway Posted July 17, 2006 Share Posted July 17, 2006 I understand, but I still need to the see the relevant tables first. Link to comment https://forums.phpfreaks.com/topic/14774-umm-fetch-rows-from-multiple-tables/#findComment-59547 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.