0
<?php

$host='localhost';
	$user='root';
	$pass='';
	
	//establish database connection
	$conn=mysql_connect($host,$user,$pass) or die('Unable to connect');
	
	//select database for use
    mysql_select_db('acumenchain') or die('Unable to select database!');
	

	    $query2 = "SELECT tblclasslist.studentNo 
					FROM acumenchain.tblclasslist 
					JOIN acumenchain.tblregistration 
					ON tblclasslist.studentNo = tblclasslist.studentNo";
					
		$result = mysql_query($query2) or die('Unable to execute Query' . mysql_error());
        $num = mysql_num_rows($result);
				

	//close connection
    mysql_close($conn);
	
?>

database name : acumenchain
Under my tblclasslist is studentNo (primary key).
Under my tblregistration is studentNo (primary key) and pword
Under my tbllogin is studentNo (primary key) and pword.

Objectives:

  • I want that only students who are registered in the tblclasslist can register on tblregistration.
  • I want that only who are registered can log-in to my site using his/her studentNo and pword.

Thanks:confused:

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by darkagn
0

Try this:

$query2 = "SELECT tblclasslist.studentNo FROM acumenchain.tblclasslist JOIN acumenchain.tblregistration ON tblclasslist.studentNo = tblregistration.studentNo JOIN acumenchain.tbllogin ON tblclasslist.studentNo = tbllogin.studentNo AND tbllogin.studentNo = tblregistration.studentNo";

Does this give the desired result?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.