jimjack145 Posted April 24, 2007 Share Posted April 24, 2007 <?PHP $loginname = ; $password = ; $database = ca; $con = mysql_connect("localhost", "$loginname", "$password") or die("could not connect"); mysql_select_db("$database"); $query1 = "SELECT candidate.first_name, candidate.last_name, user.first_name, user.last_name, client.name, joborder.title, candidate_joborder_status.short_description FROM candidate_joborder_status INNER JOIN ((((user INNER JOIN candidate ON user.user_id = candidate.owner) INNER JOIN candidate_joborder ON candidate.candidate_id = candidate_joborder.candidate_id) INNER JOIN joborder ON candidate_joborder.joborder_id = joborder.joborder_id) INNER JOIN client ON joborder.client_id = client.client_id) ON candidate_joborder_status.candidate_joborder_status_id = candidate_joborder.status WHERE (((user.user_id)=1267))"; $result = mysql_query ("$query1"); echo "<CENTER><FONT FACE='VERDANA' SIZE='4'>RM Acivity</FONT></CENTER>"; echo "<FONT FACE='VERDANA' SIZE='2'><CENTER>You are seaching for <b>'" .$_POST['rm']. "'</B></CENTER></FONT><BR>"; echo "<CENTER><TABLE BORDER=1><TH>First Name</TH><TH>Last Name</TH><TH>RM First Name</TH><TH>RM Last Name</TH><TH>Client Name</TH><TH>Client City</TH><TH>Short Description</TH>"; While ($in = mysql_fetch_array($result)) { echo "<TR>"; echo "<TD>" . $in[first_name] . "</TD>"; echo "<TD>" . $in[last_name] ."</TD>"; echo "<TD>" . $in[first_name] ."</TD>"; echo "<TD>" . $in[last_name] ."</TD>"; echo "<TD>" . $in[name] ."</TD>"; echo "<TD>" . $in[city] ."</TD>"; echo "<TD>" . $in[short_description] ."</TD>"; echo "</TR>"; } echo "</TABLE></CENTER>"; mysql_close($con); ?> With the above mentioned code i am getting result But only one problem is that there are columns name of first_name, last_name are same into candidate and user tables and at the time of display i am getting only user first and last name into candidate first and last name column. What wrong in my code can u please check and guide me. Regards, JIMI Note : IF i run same code into access its give me an appropriate result as i want. Link to comment https://forums.phpfreaks.com/topic/48426-data-reterive-from-six-table-with-help-of-inner-join-getting-code-error/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.