scotsmokin Posted November 21, 2009 Posted November 21, 2009 Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 36 Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 37 Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 51 Warning: mysql_num_rows() expects parameter 1 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 52 Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 60 Warning: mysql_insert_id() expects parameter 1 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 61 Warning: mysql_query() expects parameter 2 to be resource, null given in C:\xamp\xampp\htdocs\\register.php on line 62 here is the lines line 36...$q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c); line 37...if(mysql_num_rows($q)) line 51...$q=mysql_query("SELECT * FROM users WHERE lastip='$ip' AND userid={$_POST['ref']}",$c); line 52...if(mysql_num_rows($q)) line 60..mysql_query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '{$_POST['email']}', -1, '$ip')", $c); line 61...$i=mysql_insert_id($c); line 62...mysql_query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)", $c); found this on another forum and am getting the same errors can any one help me sort it out please Quote
Redex Posted November 22, 2009 Posted November 22, 2009 In some cases, posting only the lines which they say the error is on is not enough. The error might even be on the line above or below so you have to even post them. Hope you understand and decide to post the other lines. - Redex Quote
scotsmokin Posted November 22, 2009 Author Posted November 22, 2009 <?php session_start(); print "<html> <head> <title>Your Game Name</title> <style> body { font-family:Verdana;font-size:9pt;color: black; background-color:#C3C3C3; scrollbar-base-color: #005B70; scrollbar-arrow-color: #F3960B; scrollbar-DarkShadow-Color: #000000; } a:visited,a:active,a:hover,a:link { color: black;text-decoration: none; } table,tr,td { font-size:9pt; } img { border:none; } </style> </head> <body> "; $ip = $_SERVER['REMOTE_ADDR']; if(file_exists('ipbans/'.$ip)) { die("<font color=red size=+1>Your IP has been banned, there is no way around this.</font></body></html>"); } require "mysql.php"; global $c; if($_POST['username']) { $sm=100; if($_POST['promo'] == "Your Promo Code Here") { $sm+=100; } $username=$_POST['username']; $username=str_replace(array("<", ">"), array("<", ">"), $username); $q=mysql_query("SELECT * FROM users WHERE username='{$username}'",$c); if(mysql_num_rows($q)) { print "Username already in use. Choose another."; } else if($_POST['password'] != $_POST['cpassword']) { print "The passwords did not match, go back and try again."; } else { $_POST['ref'] = abs((int) $_POST['ref']); $ip = $_SERVER['REMOTE_ADDR']; $q=mysql_query("SELECT * FROM users WHERE lastip='$ip' AND userid={$_POST['ref']}",$c); if(mysql_num_rows($q)) { die("No creating referral multies. Bad dog."); } if($_POST['ref']) { $q=mysql_query("SELECT * FROM users WHERE userid={$_POST['ref']}",$c); $r=mysql_fetch_array($q); } mysql_query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, 'Male', unix_timestamp(), '{$_POST['email']}', -1, '$ip')", $c); $i=mysql_insert_id($c); mysql_query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)", $c); if($_POST['ref']) { require "global_func.php"; mysql_query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}",$c); event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c); mysql_query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$ip')", $c); } print "You have signed up, enjoy the game. > Login"; } } else { print "<h3>Your Game Name Registration</h3>"; print "<form action=register.php method=post>Username: <input type=text name=username> Password: <input type=password name=password> Confirm Password: <input type=password name=cpassword> Email: <input type=text name=email> Promo Code: <input type=text name=promo> <input type=hidden name=ref value='"; if($_GET['REF']) { print $_GET['REF']; } print "'> <input type=submit value=Submit></form> > Go Back"; } print "</body></html>"; ?> this is the full page in anyone can spot the errors to help out come on people some one help me out please Quote
seanybob Posted November 22, 2009 Posted November 22, 2009 Change require "mysql.php"; global $c; To require "mysql.php"; global $c; $c=1; I'm just curious what will happen. Quote
scotsmokin Posted November 22, 2009 Author Posted November 22, 2009 no change in the error it gives out Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.