i am getting these errors:
Warning: mysql_query() expects parameter 1 to be string, object given in H:\xamp\htdocs\newlogintry.php on line 12
Warning: mysql_query() expects parameter 1 to be string, object given in H:\xamp\htdocs\newlogintry.php on line 13
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in H:\xamp\htdocs\newlogintry.php on line 18
but this is the php code I wrote for it, I want to check whether the "type" of account is either teacher account or is it a pupil account if any among them then pass to main page with respective type parameter, please tell me if my usage of php is right since i am new to it, here is the php code(newlogintry.php)
<?php
$start=1;
$username=$_GET['username'];
$password=$_GET['password'];
$con=mysqli_connect("localhost","root","","repute system");
if(mysqli_connect_errno()){
echo "ERROR ".mysqli_connect_error();
}
//$result = mysqli_query($con,"SELECT password FROM accounts WHERE username=".$username);
$result = mysqli_query($con,"SELECT password,username,type,u_name FROM accounts ");
$new = mysql_query($con, "SELECT name,USN,repute,acc_type,u_name FROM pupil ");
$new1= mysql_query($con,"SELECT name,id,repute,acc_type,u_name FROM teacher");
if(mysqli_num_rows($new)>0)
{
while($row = mysqli_fetch_assoc($new)) {
$pupilaccount = $row['acc_type'];
if(mysqli_num_rows($new1)>0)
{
while($row = mysqli_fetch_assoc($new1)) {
$teacheraccount = $row['acc_type'];
if(mysqli_num_rows($result)>0)
{
while($row = mysqli_fetch_assoc($result)) {
$pass=$row['password'];
$use=$row['username'];
$type=$row['type'];
if( $type==$teacheraccount and $password == $pass and $username==$use){
header("location:http://localhost/index.php?param=$teacheraccount¶m1=$username");
exit();
}
else if($type==$pupilaccount and $password == $pass and $username==$use)
{
header("location:http://localhost/index.php?param==$pupilaccount¶m1=$username");
exit();
}
}
}
}
}
}
}
}
?>