include '../incs/connect.php';
$q=mysqli_query($con,"SELECT appl_reg_details.appl_id, appl_reg_details.apl_name, appl_reg_details.apl_email, rp_test_result.appl_status, rp_intv_result.intv_obt_marks
FROM appl_reg_details
INNER JOIN rp_test_result ON appl_reg_details.appl_id = rp_test_result.appl_id
INNER JOIN rp_intv_result ON rp_test_result.appl_id = rp_intv_result.appl_id
GROUP BY appl_reg_details.appl_id
");
WHILE($row=mysqli_fetch_array($q))
{
echo $row=['appl_id']." - ";
echo $row=['apl_name']." - ";
echo $row=['intv_obt_marks']." - ";
echo $row=['appl_status']." -";
echo $row=['apl_email']."<br/>";
}
I have 3 tables and i want to get data of 3 field from table1, of 1 field from table 2 and table 3 each, i have found that inner join can do this, when i run this it says 'Notice: Array to string conversion', help to correct this or give a new way please
The query looks fine at first glance.
The problem is with the lines below it. They include an unnecessary =
:
echo $row=['apl_email']."<br/>";
These lines should be like this:
echo $row['apl_email']."<br/>";
Performance benefits aside, GROUP BY serves no purpose here other than to confuse the result set. Try something like this instead, and fix the coding errors identified by rjdown:
SELECT DISTINCT d.appl_id
, d.apl_name
, d.apl_email
, t.appl_status
, i.intv_obt_marks
FROM appl_reg_details d
JOIN rp_test_result t
ON t.appl_id = d.appl_id
JOIN rp_intv_result i
ON r.appl_id = i.appl_id;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.