
Originally Posted by
hubert
As I'm in the process of upgrading to 1.5.4 on a server running PHP 5.6 this
Code:
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
.
Would this replacement work and is it the write syntax ?
Code:
$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
No, it would not, also if you were to look at the forum thread for the plugin then would see that there is/should be a version available that is compatible to 1.5.4 simplifying your effort... and really? this code doesn't use a table define but instead the table format from below? Wow, didn't realize it needed that kind of upgrading...
a rewrite of this could be:
Code:
$sql = "SHOW TABLES LIKE '".DB_PREFIX."so_payment_types'";
$result = $db->Execute($sql);
$row_cnt = $result->RecordCount();
if(!$result->EOF && $row_cnt > 0){
$sql = "TRUNCATE TABLE ".DB_PREFIX."so_payment_types";
$db->Execute($sql);
}
That is if $row_cnt is used further below... If not then it could be reduced to something like:
Code:
$sql = "SHOW TABLES LIKE '".DB_PREFIX."so_payment_types'";
$result = $db->Execute($sql);
if(!$result->EOF && $result->RecordCount() > 0){
$sql = "TRUNCATE TABLE ".DB_PREFIX."so_payment_types";
$db->Execute($sql);
}
But there probably is another way that it has been incorporated or otherwise done... Again, suggest looking at the work that has already been done which will also simplify future upgrades...
Bookmarks