I am trying to create a simple process that checks if a username is taken already during the login process.
I have a simple php script that querys the database and then i check to see if there are any results and echos a response to the user
the full error that i get is: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home1/tbronson/public_html/sandbox/uname_check.php on line 9
The entire php script is:
<?php
$user = "(removed for security)";
$pass = "(removed for security)";
$db = "budgetbidders_users";
$con = mysqli_connect($host,$user,$pass,$db);
$uname = strip_tags( trim( $_POST['uname'] ) );
$result = mysqli_query($con,"SELECT * FROM `users` WHERE uname = '" .$uname . '");
$numrows = mysql_num_rows($result); //line 9
if ($numrows > 0) {
$end_result = "Username already taken";
}
else {
$end_result = "";
}
echo $end_result;
?>
I have searched for hours and tried multiple variations, this seems to be the closest to correct that i can find, thank you for your help!