blue-genie Posted March 31, 2010 Share Posted March 31, 2010 I have a simple login script <?php session_start(); include 'config.php'; include 'opendb.php'; //This function will find and checks if your data is correct function login(){ //Collect your info from login form $admin = $_REQUEST['username']; $password = $_REQUEST['password']; $result = mysql_query("SELECT * FROM adminusers WHERE username ='$admin'"); $row = mysql_fetch_array($result); // mysql_fetch_array return false if no record but not null if (!$row) { echo '<?xml version="1.0"?>'; echo '<dataxml>'; echo '<row type="error">'; echo "<errorMsg>Can't find user on system.</errorMsg>"; echo "</row>"; echo '</dataxml>'; die(); } else { // check password now if record found if($row['password'] == $password){ $username = $row['username']; $id = $row['adminID']; echo '<?xml version="1.0"?>'; echo '<dataxml>'; echo '<row type="success">'; echo "<firstname>".$row['username']."</firstname>"; echo "<userID>".$row['adminID']."</userID>"; echo "</row>"; echo '</dataxml>'; if(isset($_SESSION['admin'])) $_SESSION['admin'] = $id; else $_SESSION['admin'] = $id; } else { // show error if user found but password incorrect echo '<?xml version="1.0"?>'; echo '<dataxml>'; echo '<row type="error">'; echo "<errorMsg>Incorrect Password.</errorMsg>"; echo "</row>"; echo '</dataxml>'; die(); } } } login(); ?> on my local xampp folder http://127 etc works fine when i load everything up on a remote server I get the warning Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/biddcdbz/public_html/games/sun_soccer/admin/adminLogin.php on line 19 Can't find user on system. line #19 is this $row = mysql_fetch_array($result) Quote Link to comment https://forums.phpfreaks.com/topic/197117-error-on-one-version-of-xampp-and-not-another/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 31, 2010 Share Posted March 31, 2010 If you search for any portion of that error message you will find that it means that your query failed to execute due to an error. For debugging purposes only (remove it after you are done), echo msyql_error(); on the next line right after the line with the mysql_query() statement. Quote Link to comment https://forums.phpfreaks.com/topic/197117-error-on-one-version-of-xampp-and-not-another/#findComment-1034728 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.