View Full Version : PHP Help.

02-20-02, 08:33 PM
hey guys, i just read a tutorial from devshed.com and used their code as a sample. it works and all, but i get an unwanted error and am unsure on how to get rid of it.

this is the error:

Warning: Supplied argument is not a valid MySQL result resource in c:\newsite\phptest\newuser.php on line 11

Thanks for logging in!

To see what the page looks like with your personal settings, please return.

that obviously means it works, but i get that error. and i also know it works because i go back, login and etc. and it recognizes the new username.

heres the code for the newuser.php

<? SetCookie("visitor",$login,time()+864000); ?>
mysql_connect("localhost", "joe", "joe") or DIE("Unable to
connect to database");
@mysql_select_db("login5") or die("Unable to select database");

$result = mysql_query("Select * from users where login='$login'");
if(!mysql_numrows($result)) {
#Make a new login - entire page follows
$result = mysql_query("insert into users values (

Thanks for logging in!<br><br>
To see what the page looks like with your personal
settings, please <a href="index.php">return</a>.
<? }

else {

echo "Whoa! Someone has already picked that username!<br><br>";
echo "Please hit the back button and pick a unique login.";

} ?>

does anyone know how to get rid of this error?

also, this is using apache and mysql from my own computer, which i installed and am using for this script.

02-21-02, 12:04 PM

02-21-02, 01:37 PM
can you maybe point out line 11 in your source. at least I can try to help you

02-21-02, 02:05 PM
woops, sorry. this is line 11

if(!mysql_numrows($result)) {

02-21-02, 02:16 PM
agh. can't find any documents on PHP.
mebe it's mysql_num_rows and not mysql_numrows
damn, wished I could've been more help

02-21-02, 07:07 PM
That's it Sadrok. :)

It is mysql_num_rows.