Zen Follower
- Join Date:
- Mar 2012
- Posts:
- 132
- Plugin Contributions:
- 0
Error 500 when accessing db
ZC =1.5.0 PHP=5.6
Hi all,
I tried to connect to db and I got and error 500 with my custom code. First I thought the problem is on my custom code but then I tried an following example and still got the server error 500:
<?php
$theProductId = 25;
global $db;
$sql = "select zen_products_model from " . TABLE_PRODUCTS . " where products_id = :productID:";
$sql = $db->bindVars($sql, ':productID:', $theProductId, 'integer');
$result = $db->Execute($sql);
if ($result->RecordCount() > 0) {
echo 'Model number = ' . $result->fields['products_model'];
} else {
echo 'Sorry, no record found for product number ' . $theProductId;
}
?>
Any help would be greatly appreciated. There were no errors in zencart error.log