Jump to content

mysql_fetch_row() expects parameter 1 to be resource


sarathwhr

Recommended Posts

Hello,

 

I am getting the following error:
 

====
Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/user/public_html/magento-db-repair-tool-1.1.php on line 378

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in /home/user/public_html/magento-db-repair-tool-1.1.php on line 391
====


I believe it is something with the code since I haven’t touched that file. A quick googling also lead me to the same conclusion. Please help.

Pasting lines below (from 378 to 391) :

====

while($row = mysql_fetch_row($res)) {
$tableProp[’fields’][$row[0]] = array(
‘type’ => $row[1],
‘is_null’ => strtoupper($row[3]) == ‘YES’ ? true : false,
‘default’ => $row[5],
‘extra’ => $row[6],
‘collation’ => $row[2],
);
}

// create sql
$sql = “SHOW CREATE TABLE `{$tableName}`”;
$res = mysql_query($sql, $this->_getConnection($type));
$row = mysql_fetch_row($res);
====

Hello,

 

Thanks for your reply. My code is :

====
// collect fields
        $sql = "SHOW FULL COLUMNS FROM `{$tableName}`";
        $res = mysql_query($sql, $this->_getConnection($type));
        while($row = mysql_fetch_row($res)) {
            $tableProp['fields'][$row[0]] = array(
                'type'      => $row[1],
                'is_null'   => strtoupper($row[3]) == 'YES' ? true : false,
                'default'   => $row[5],
                'extra'     => $row[6],
                'collation' => $row[2],
            );
        }

        // create sql
        $sql = "SHOW CREATE TABLE `{$tableName}`";
        $res = mysql_query($sql, $this->_getConnection($type));
        $row = mysql_fetch_row($res);

        $tableProp['create_sql'] = $row[1];
====

Can you tell me where exactly modification is needed? Replace $res = mysql_query($sql, $this->_getConnection($type));
with
$res = mysql_query($query) or die('Error:' . mysql_error())     ?

Hello,

 

I tried replacing  $res = mysql_query($sql, $this->_getConnection($type));

 

with

 

$res = mysql_query($sql, $this->_getConnection($type)) or die('Error:' . mysql_error());

 

But, same result  :  I am not sure if that is what you asked me to try.

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.