calmchess Posted March 30, 2010 Share Posted March 30, 2010 I need to select data from 3 tables that all have usename as the common data......now after selecting the data i need to arrange it so that all the users relevant data from the 3 tables is in a table or array or somthing........starts out something like this <?php $conn = mysql_connect("127.0.0.1", "root", "secret") or die(mysql_error()); mysql_select_db("testsuite",$conn) or die(mysql_error()); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// $result0=mysql_query("select id,name from mprofiles") or die(mysql_error()); $row0 = mysql_fetch_array( $result0 ); $current0 = $row0['name']; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// $result1=mysql_query("select country from members") or die(mysql_error()); $row1 = mysql_fetch_array( $result1 ); $current1 = $row1['country']; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// $result2=mysql_query("select cpm from vfcp_profile") or die(mysql_error()); $row2 = mysql_fetch_array( $result2 ); $current2 = $row2['cpm']; //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// echo $current0; echo $current1; echo $current2; ?> Link to comment https://forums.phpfreaks.com/topic/196997-seperate-mysql-table-with-common-username/ Share on other sites More sharing options...
gizmola Posted March 31, 2010 Share Posted March 31, 2010 Have you read about the SQL "join"? You should be able to inner join the 3 tables together on the common element and receive a single result set that you can then fetch. Link to comment https://forums.phpfreaks.com/topic/196997-seperate-mysql-table-with-common-username/#findComment-1034492 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.