Jump to content

mysql_fetch_array() error


Go to solution Solved by haku,

Recommended Posts

hi guys,  i can't resolve this error "The requested URL /<br /><b>Warning</b>: mysql_fetch_array() expects parameter 1 to be resource, boolean given in <b>/home/nerdto/greenfair/include/bit_functions.inc.php</b> on line <b>33</b><br />//auction/ was not found on this server."

 

where is the problem?

thanks

 

 

function getStart($limit)

{
if((!isset($_GET['page'])) || ($_GET['page'] == "1")) {
        $start = 0;
        $_GET['page'] = 1;
     } else {
        $start = ($_GET['page']-1) * $limit;
     }
     return $start;
}
function get_cat_name($cat)
{
$rec=mysql_fetch_array(mysql_query("select name,top from add_category where id=$cat"));
 
 if($rec['top'] > 0)
 {
return get_cat_name($rec['top'])."/".str_replace(" ","-",trim($rec['name']));
 }
 else
 return str_replace(" ","-",trim($rec['name']));
 
}

 

Link to comment
https://forums.phpfreaks.com/topic/276079-mysql_fetch_array-error/
Share on other sites

  • Solution

Assuming this is line 33 (you didn't say):

 

$rec=mysql_fetch_array(mysql_query("select name,top from add_category where id=$cat"));

 

Change it to this:

 

$rec = mysql_query("select name,top from add_category where id=$cat") OR die(mysql_error());

 

Then run it and let us know what the error is.

Edited by haku

Assuming this is line 33 (you didn't say):

 

$rec=mysql_fetch_array(mysql_query("select name,top from add_category where id=$cat"));

 

Change it to this:

 

$rec = mysql_query("select name,top from add_category where id=$cat") OR die(mysql_error());

 

Then run it and let us know what the error is.

thanks so much, it is a featured product slider i resolved it simply adding a product to it

but now i have another problem while trying to register as user

 

 

Unknown column 'ip' in 'field list'insert into user (id,gender,first_name,last_name,uname,bday,country,password,email,ccode,ip,stat_date) values('','male','myname','mysurname','myusername','mybirthdate','','mypassword','myemail','5b73b8ccdb','82.61.52.40',now())

You are trying to insert data into a database column called 'ip' which doesn't exist.

yes i checked in phpadmin and there isn't "ip", i tried to remove it from register page but show me another error... how can i create it?

done, thanks :)

Edited by conidig

if i can i would like to ask another question

 

i'm configuring an auction website... but the website display this error, 500 Internal Server Error

it is a subdomain so i'm not really convinced that i configured it correctly

 

 

$config = array(

        'Database' => array(
            'driver'     => 'mysql',
            'persistent' => false,
            'host'       => 'localhost', // MySQL Hostname, usually 'localhost'
            'login'      => 'xxxx_admin', // MySQL Username
            'password'   => 'xxx', // MySQL Password
            'database'   => 'xxxx_bid', // MySQL Database Name
            'prefix'     => '', // not usually required, leave blank
            'encoding' => 'utf8' 
        ),
 
 
 
//  *******************************************************************************************
 
 
 
 
        'App' => array(
'license'                => 'xxxx', // Paste your license key
'encoding'               => 'UTF-8',
'baseUrl'                => 'http://bid.xxx.com' // Required only if using subdomain/folder
'base'                   => 'http://bid.xxxx.com' // Required only if using subdomain/folder
'dir'     => '/home/xxx', // Required only if using subdomain/folder
'webroot' => 'webroot',
'name'                   => 'Site Title Here',
'url'                    => 'http://www.bid.xxx.com' // fill this out
'ref_url'                => 'http://www.bid.xxx.com' // fill this out
'nml_url'                => 'http://www.bid.xxx.com' // fill this out
'serverName'             => '', //  this isn't usually needed 
'timezone'               => 'London/England', // check the Time Zone article in the Knowledge Base for the correct syntax
'language'               => 'eng', // Three-letter only, eng = English. 
'email'                  => 'inf@xxx.com', // fill this out and change it to desired email
'currency'               => 'USD', // Three-letter currency code, i.e. GBP, USD, CAD. For other currencies, please see Knowledge Base

[sun Mar 24 13:49:31 2013] [alert] [client 82.61.52.40] /home/xxxx/xxxxx/.htaccess: </files> without matching <files> section

 

what does it mean?

 

this is .htaccess

 

<IfModule mod_rewrite.c>

   RewriteEngine on
   RewriteRule (.*\.(png|gif|jpg|jpeg|js|css|swf))$ webroot/img_handler.php?arg=$1 [L] 
   RewriteRule    ^$ webroot/    [L]
   RewriteRule    (.*) webroot/$1 [L]
</IfModule>
 
 
# disable directory browsing -IMPORTANT, do NOT remove.
Options -Indexes
 
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
 
# disable the server signature
ServerSignature Off
 
 
# protect php.ini
#<files *.ini>
order allow,deny
deny from all
</files>
Edited by conidig

You see this:

 

#<files *.ini>

 

The # sign comments out hte line - meaning it's not read by the system. This means you have a closing files tag (that comes below this line), but no opening files tag (which is what the error is telling you)

thanks but now show a blank page, can you check the php above?

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.