Zen Follower
- Join Date:
- Mar 2005
- Posts:
- 229
- Plugin Contributions:
- 0
mysql_num_rows error
As I'm in the process of upgrading to 1.5.4 on a server running PHP 5.6 this
if( mysql_num_rows( mysql_query("SHOW TABLES LIKE '".DB_PREFIX."so_payment_types'"))){
$sql = "TRUNCATE TABLE ".DB_PREFIX."so_payment_types";
$db->Execute($sql);
}
``` (which is Super_orders' init_so_config.php) fire me with
> PHP Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /ADMIN/includes/init_includes/init_so_config.php on line 13.
Would this replacement work and is it the write syntax ?
$sql = "SHOW TABLES LIKE '".DB_PREFIX."so_payment_types'";
$result = $db->Execute($sql);
$row_cnt = $result->num_rows;
if($row_cnt){
$sql = "TRUNCATE TABLE ".DB_PREFIX."so_payment_types";
$db->Execute($sql);
}
Thanks for your help
Hubert