Pandareen Posted January 4, 2012 Share Posted January 4, 2012 Hello!Can i echo data from 2 or more tables on the same page? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/ Share on other sites More sharing options...
Adam Posted January 4, 2012 Share Posted January 4, 2012 Yes Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304197 Share on other sites More sharing options...
Pandareen Posted January 4, 2012 Author Share Posted January 4, 2012 oke, so i just connect to each table and then echo from them?Can u give me a query exemple please? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304210 Share on other sites More sharing options...
Pikachu2000 Posted January 4, 2012 Share Posted January 4, 2012 Your question is far too vague. Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304211 Share on other sites More sharing options...
Pandareen Posted January 4, 2012 Author Share Posted January 4, 2012 well, i have table1, table2, table 3 and i want to echo on my page info from each table, and i want to know how :-? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304216 Share on other sites More sharing options...
Adam Posted January 4, 2012 Share Posted January 4, 2012 Are you meaning to query 3 separate tables over 3 separate queries, or query 3 relational tables in 1 query? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304219 Share on other sites More sharing options...
litebearer Posted January 4, 2012 Share Posted January 4, 2012 need a bit more detail... ie what have you tried thus far? is the data in the 3 tables related in any way? will the displayed data be placed together or in separate areas of your page? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304220 Share on other sites More sharing options...
Pandareen Posted January 4, 2012 Author Share Posted January 4, 2012 well, i have 3 tables, let's say cars, houses and cats( with no relations between them ), and i want to echo data from them ( name, pic and info ) in 3 diferent tables from my webpage ( 1 for cars, 1 for houses and 1 for cats ) so yes, i want 3 separate tables over 3 separate querrys.It can be done? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304225 Share on other sites More sharing options...
Adam Posted January 4, 2012 Share Posted January 4, 2012 Do you know how to do one query? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304236 Share on other sites More sharing options...
Pandareen Posted January 4, 2012 Author Share Posted January 4, 2012 yes i know how to echo from one table :-? Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304239 Share on other sites More sharing options...
litebearer Posted January 4, 2012 Share Posted January 4, 2012 rough psuedo-code... connect to db $query1 = "SELECT pic, name, from cars"; $query2 = "SELECT picture, firstname, from houses"; $query3 = "SELECT pic, name, color from cats"; $result1 = mysql_query($query1); $result2 = mysql_query($query2); $result3 = mysql_query($query3); while($row1 = mysql_fetch_array($result1) { echo $row1['pic'] . " - " . $row1['name'] . "<br/>"; } echo "<hr>"; while($row2 = mysql_fetch_array($result2) { echo $row2['picture'] . " - " . $row1['firstname'] . "<br/>"; } echo "<hr>"; while($row3 = mysql_fetch_array($result3) { echo $row1['pic'] . " - " . $row1['name'] . $row3['color'] . "<br/>"; } Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304242 Share on other sites More sharing options...
Maq Posted January 4, 2012 Share Posted January 4, 2012 well, i have 3 tables, let's say cars, houses and cats( with no relations between them ), and i want to echo data from them ( name, pic and info ) in 3 diferent tables from my webpage ( 1 for cars, 1 for houses and 1 for cats ) so yes, i want 3 separate tables over 3 separate querrys.It can be done? Your lack of attempt leads me to believe that you have not done any research. We are not here to do your work for you. We already said it was possible and there are probably thousands of examples on this site alone. People will be more willing to help if you actually try first If you provide us with the appropriate information and maybe some code you've tried, we'll be able to help you. Link to comment https://forums.phpfreaks.com/topic/254351-echo-question/#findComment-1304260 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.