mysql join query
SELECT
m.member_id,
m.name member,
c.committee_id,
c.name committee
FROM
members m
INNER JOIN committees c
ON c.name = m.name;
mysql join query
SELECT
m.member_id,
m.name member,
c.committee_id,
c.name committee
FROM
members m
INNER JOIN committees c
ON c.name = m.name;
use join in mysqli
<?php
$dbhost = 'localhost:3306';
$dbuser = 'root';
$dbpass = '';
$dbname = 'TUTORIALS';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname);
if(! $conn ) {
die('Could not connect: ' . mysqli_error());
}
echo 'Connected successfully</br>';
$sql = 'SELECT a.id, a.name,b.id FROM tutorials_inf a,tutorials_bks b WHERE a.id = b.id';
if($result = mysqli_query($conn, $sql)) {
if(mysqli_num_rows($result) > 0) {
echo "<table>";
echo "<tr>";
echo "<th>id</th>";
echo "<th>name</th>";
echo "<th>id</th>";
echo "</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['id'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_free_result($result);
} else {
echo "No records matching your query were found.";
}
} else {
echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);
}
mysqli_close($conn);
?>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us