powerfulsquid
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); ?>
<HTML>
<HEAD><TITLE>Thanks!</TITLE></HEAD>
<BODY>
<?
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 (
'$login',
'$password',
NOW(),
'$news1',
'$news2',
'$news3')");
?>
<br>
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.";
} ?>
</body>
</html>
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.
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); ?>
<HTML>
<HEAD><TITLE>Thanks!</TITLE></HEAD>
<BODY>
<?
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 (
'$login',
'$password',
NOW(),
'$news1',
'$news2',
'$news3')");
?>
<br>
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.";
} ?>
</body>
</html>
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.