Jump to content

error on one version of xampp and not another?


blue-genie

Recommended Posts

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)

 

 

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.