justinba1010 Posted August 9, 2011 Share Posted August 9, 2011 /* Checks for inserted data * otherwise quits with exit command */ // MySQL Connect $con01 = mysql_connect("localhost","root",""); mysql_select_db("game"); if(isset($_POST['username'])&& isset($_POST['username'])) { $username = $_POST['username']; $username = stripslashes($username); $username = mysql_escape_string($username); $password = $_POST['password']; $password = stripslashes($password); $password = mysql_escape_string($password); $password = md5($password); } else exit("You haven't entered either a username and/or a password."); // Query $query = mysql_query("SELECT * FROM login WHERE username = '$username' AND password = '$password'")or exit("Couldn't find you in the login."); $edie = mysql_num_rows($query); while($row = mysql_fetch_assoc) { $dbVN = $row['vilnum']; } if($edie = 1&&$dbVN=0) { while($row = mysql_fetch_assoc($query)) { $dbuid = $row['uid']; } $query = mysql_query("SELECT * FROM villages WHERE uid = '0' AND type = '0' LIMIT 0,1"); while($row = mysql_fetch_assoc($query)) { $dbvid = $row['vid']; $dbx = $row['x']; $dby = $row['y']; } echo "$dbx<br>$dby<br>$dbvid"; } if(!$dbvid||!$dbx||!$dby) { exit; } // Updates $query = mysql_query("UPDATE villages SET uid = '$dbuid' AND vilnum = '1' WHERE vid = '$dbvid' AND x = '$dbx' AND y = '$dby'") or exit("Unknown Error #1"); $query = mysql_query("UPDATE login SET vilnum = '1' WHERE uid = '$dbuid'") or exit("Unknown Error #2"); ?> Well I tried them in phpmyadmin, they work there, but something is wrong here. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted August 9, 2011 Share Posted August 9, 2011 Your forgot to state what exact symptom or error you saw in front of you that would let someone on a help forum actually help. Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 9, 2011 Share Posted August 9, 2011 Several issues here, I'll post a few: 1. why is this duplicated? if( isset($_POST['username']) && isset($_POST['username']) ) 2. mysql_escape_string is depricated. 3. while($row = mysql_fetch_assoc) has no query associated to it. 4. if($edie = 1&&$dbVN=0) should be if($edie == 1 && $dbVN == 0) Quote Link to comment Share on other sites More sharing options...
justinba1010 Posted August 9, 2011 Author Share Posted August 9, 2011 Several issues here, I'll post a few: 1. why is this duplicated? if( isset($_POST['username']) && isset($_POST['username']) ) 2. mysql_escape_string is depricated. 3. while($row = mysql_fetch_assoc) has no query associated to it. 4. if($edie = 1&&$dbVN=0) should be if($edie == 1 && $dbVN == 0) Thank you so much! Was a bit tired, really didn't do it good as others I did. Overthought a lot of it. Quote Link to comment Share on other sites More sharing options...
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.