Confused...

admin

Administrator
Staff member
I am receiving this warning in a script of mine...I have no clue how to fix it. It may be because I am new to this, but I'm not sure.


Warning: 0 is not a MySQL result index
on line 20.

I know this is sloppy PHP, but here is my script:

$tablename = "tablename";
$mysql_db = "databasename";
$mysql_user = "username";
$mysql_pass = "password";
$mysql_link = mysql_connect("www.someserver.org", $mysql_user, $mysql_pass);
mysql_select_db($mysql_db, $mysql_link) or die("Could not connect to database: ". mysql_error());
$select_query = "SELECT COUNT_ID,username,password,email,level from $tablename WHERE COUNT_ID=$id";
mysql_query($select_query, $mysql_link) or die("Could not complete query: ". mysql_error());
$result = $select_query;
if ($row = mysql_fetch_array($result)){
echo "User $row[0] is $row[1] and has level $row[4] access.";
}
else {echo "Sorry Not Found!";}
 
Back
Top