Jump to content

Recommended Posts

I'm having trouble with this user verify script I made. And I know it's the SQL getting confused, whether it is the variable set-up I don't know. This is just a included file, and in the index file, it's already connected to the database, and there is no errors with that because the error is:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /dir/userver.inc on line 11

count unavailable

 

And count unavailable is apart of one of my SQL function error messages.

 

<?php
//User Name Verify

function userver($userveri)
{

$query = "SELECT 'username' FROM 'users' WHERE 'username'='$userveri'";

$sql = mysql_query($query);

$nrows = mysql_num_rows($sql) or die("count unavailable");



if($nrows != 0)
{
echo "The username you have chosen already exists!";
die();
} 
else 
{
return($userveri);
}

}
?>

 

Help is appreciated.

Link to comment
https://forums.phpfreaks.com/topic/45147-solved-my-sql-num_row-help/
Share on other sites

<?php
//User Name Verify

function userver ( $userveri )
{

$query = "SELECT username FROM users WHERE username = '$userveri'";
$sql = mysql_query($query);
if(mysql_num_rows($sql) > 0)
{
echo "The username you have chosen already exists!";
die();
} 
else 
{
return $userveri;
}

}
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.