Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $db = new mysqli('localhost','root','','test');
- $result = $db->query("SELECT students.*,teachers.name FROM students,teachers WHERE students.id='$id' AND students.class = teachers.class");
- if($result->num_rows){
- while ($row = $result->fetch_assoc()) {
- echo 'Name: '.$row['name'];
- echo 'Class: '.$row['class'];
- }
- }
- mysqli_close($db);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement