Jump to content
MakeWebGames

Recommended Posts

Posted

So I'm tweaking the profile pic upload to upload and display a gang flag

But I'm getting this error

 

A critical error has occurred, and page execution has stopped. Below are the details:

PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, null given (2)

Snippet area

/*Check DB*/
   $check = mysql_query(
   sprintf("SELECT COUNT(*) as cnt FROM `users` WHERE `gangFLAG` = '%s'",
   mysql_real_escape_string($picture)));

   $checks = mysql_fetch_array($checks);

   if ($checks['cnt'] > 0) {
       echo 'Please use another image name
Back';
       $h->endpage(); exit;
   }
Posted

change to mysqli

now its

PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given (2)

This is the same code as used in another upload form. Not sure what I'm missing

Posted

As Coly said you are passing the variable $checks to the fetch array which is the variable your creating you need to pass the variable that holds the query which you used $check

i think you have got yourself confused when adding it i would suggest if you are going to name variables like this then shorten the one on the fetch

$check = mysql_query("some query");

$ch = mysql_fetch_array($check);

if($ch['something']) {

run code

}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...