Here's the code
require('config.php');
$db = mysql_connect($host, $user);
mysql_select_db("members",$db);
$sql="SELECT * FROM details WHERE (username=$username)";
$result = mysql_query($sql);
$check_num = mysql_num_rows($result);
$sql_insert="INSERT INTO details (first, last, username, password, email, location, URL, title) VALUES ('$first','$last','$username','$password','$email','$location','$URL','$title')";
if ($check_num > 0){
?>
Sorry, that username has already been taken. Please hit you back button and choose another.
<?php
}else{
mysql_query($sql_insert);
}
And here's the error I get
Warning: Supplied argument is not a valid MySQL result resource in d:\adduser.php on line 7
Line 7 is $check_num = mysql_num_rows($result);