http://www.opencart.com/index.php?route ... rch=Mysqli
Ernie
openshop.li
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
A week or so ago my page stopped working. I would really appreciate any insight or help as to how to fix it. I will try to include as many details as possible. Here we go.
1. I went to my site and noticed the header had an error code in it and some of the shopping cart features seemed a bit buggy as well. Here is the error that was showing in the header
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/uvapeca/public_html/system/database/mysql.php on line 6
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/uvapeca/public_html/system/database/mysql.php:6) in /home/uvapeca/public_html/system/library/session.php on line 11Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/uvapeca/public_html/system/database/mysql.php:6) in /home/uvapeca/public_html/system/library/session.php on line 11Warning: Cannot modify header information - headers already sent by (output started at /home/uvapeca/public_html/system/database/mysql.php:6) in /home/uvapeca/public_html/index.php on line 179Warning: Cannot modify header information - headers already sent by (output started at /home/uvapeca/public_html/system/database/mysql.php:6) in /home/uvapeca/public_html/system/library/currency.php on line 45Warning: Cannot modify header information - headers already sent by (output started at /home/uvapeca/public_html/system/database/mysql.php:6) in /home/uvapeca/public_html/catalog/controller/journal2/product_tabs.php on line 28 - See more at: http://uvape.ca/ejuice/jc-classic-tobac ... T2j0N.dpuf
2. They sent me here for help viewtopic.php?t=110180#p438507 -- I then tried playing around with the mysqli.php and keep getting different errors now.
3. Seems there is something with the code at the end it does not like. Here is the error that is currently being display on my webpage www.uvape.ca
Parse error: syntax error, unexpected end of file in /home/uvapeca/public_html/system/database/mysqli.php on line 75
4. The CRA are looking for me to file my taxes and I cant get to my reports in my admin panel either because of this error. I would seriously appreciate any help I could get on this. I have tried to fix the error by myself and I fear I am making it worse.
5. Here is what my current mysqli.php file reads.
<?php
if (!class_exists('MySQLi')) {
final class MySQLi{
private $mysqli;
public function __construct($hostname, $username, $password, $database) {
$this->mysqli = new mysqli($hostname, $username, $password, $database);
if ($this->mysqli->connect_error) {
trigger_error('Error: Could not make a database link (' . $this->mysqli->connect_errno . ') ' . $this->mysqli->connect_error);
}
$this->mysqli->query("SET NAMES 'utf8'");
$this->mysqli->query("SET CHARACTER SET utf8");
$this->mysqli->query("SET CHARACTER_SET_CONNECTION=utf8");
$this->mysqli->query("SET SQL_MODE = ''");
}
public function query($sql) {
$result = $this->mysqli->query($sql);
if ($this->mysqli->errno) {
//$mysqli->errno
if (is_resource($resource)) {
$i = 0;
$data = array();
while ($row = $result->fetch_object()) {
$data[$i] = $row;
$i++;
}
$result->close();
$query = new stdClass();
$query->row = isset($data[0]) ? $data[0] : array();
$query->rows = $data;
$query->num_rows = $result->num_rows;
unset($data);
return $query;
} else {
return true;
}
} {
trigger_error('Error: ' . mysql_error($this->link) . '<br />Error No: ' . mysql_errno($this->link) . '<br />' . $sql);
exit();
} }
public function escape($value) {
return $this->mysqli->real_escape_string($value);
}
public function countAffected() {
return $this->mysqli->affected_rows;
}
public function getLastId() {
return $this->mysqli->insert_id;
}
public function __destruct() {
$this->mysqli->close();
}
}
?>
Code: Select all
<?php
final class DBMySQLi {
private $link;
public function __construct($hostname, $username, $password, $database) {
$this->link = new mysqli($hostname, $username, $password, $database);
if (mysqli_connect_error()) {
trigger_error('Error: Could not make a database link (' . $this->link->connect_errno . ') ' . $this->link->connect_error);
exit();
}
$this->link->set_charset("utf8");
$this->link->query("SET SQL_MODE = ''");
}
public function query($sql) {
$query = $this->link->query($sql);
if (!$this->link->errno){
if (isset($query->num_rows)) {
$data = array();
while ($row = $query->fetch_assoc()) {
$data[] = $row;
}
$result = new stdClass();
$result->num_rows = $query->num_rows;
$result->row = isset($data[0]) ? $data[0] : array();
$result->rows = $data;
unset($data);
$query->close();
return $result;
} else{
return true;
}
} else {
trigger_error('Error: ' . $this->link->error . '<br />Error No: ' . $this->link->errno . '<br />' . $sql);
exit();
}
}
public function escape($value) {
return $this->link->real_escape_string($value);
}
public function countAffected() {
return $this->link->affected_rows;
}
public function getLastId() {
return $this->link->insert_id;
}
public function __destruct() {
$this->link->close();
}
}
?>
Code: Select all
unset($data);
...
...
...
...
return $query;
Ernie
openshop.li
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
"PHP Unknown: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead"
...on my vqcache files. I deleted the vqcache but they are still occurring. Did I miss a step somewhere?
Thanks
Matt
But just download the 3 files below, and try them out, if you have not already done this before:
---
mysqli for opencart V5.5.x (should mean V1.5.5.x, I guess!)
if using this, you have to rename your config.php DB File Name Line from
define('DB_DRIVER', 'mysqli');
to
define('DB_DRIVER', 'mysqliz');
http://www.opencart.com/index.php?route ... n_id=24413
----
MySQLiz - MySQLi support
if using this, you have to rename your config.php DB File Name Line from
define('DB_DRIVER', 'mysqli');
to
define('DB_DRIVER', 'mysqliz');
http://www.opencart.com/index.php?route ... n_id=13041
----
if using this modified russian File, you have to rename your config.php DB File Name Line from
define('DB_DRIVER', 'mysqli');
back to
define('DB_DRIVER', 'mysql');
----
On the Page, press the Buttom on the TOP, called Скачать
after clicking this Link:
https://opencartforum.com/files/file/83 ... B0-mysqli/
Good Luck!
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
show me your BOTH config.php entries (exept for passwords!)
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Here's my config.php
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://www.site.com/');
define('HTTP_IMAGE', 'http://www.site.com/image/');
define('HTTP_ADMIN', 'http://www.site.com/admin/');
// HTTPS
define('HTTPS_SERVER', 'https://www.site.com/');
define('HTTPS_IMAGE', 'https://www.site.com/image/');
// DIR
define('DIR_APPLICATION', '/home/site/domains/site.com/public_html/catalog/');
define('DIR_SYSTEM', '/home/site/domains/site.com/public_html/system/');
define('DIR_DATABASE', '/home/site/domains/site.com/public_html/system/database/');
define('DIR_LANGUAGE', '/home/site/domains/site.com/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/site/domains/site.com/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/site/domains/site.com/public_html/system/config/');
define('DIR_IMAGE', '/home/site/domains/site.com/public_html/image/');
define('DIR_CACHE', '/home/site/domains/site.com/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/site/domains/site.com/public_html/download/');
define('DIR_LOGS', '/home/site/domains/site.com/public_html/system/logs/');
// DB
define('DB_DRIVER', 'mysqliz');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'xxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'xxxxxxxxx');
define('DB_PREFIX', 'oc');
?>
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://www.site.com/admin/');
define('HTTP_CATALOG', 'http://www.site.com/');
define('HTTP_IMAGE', 'http://www.site.com/image/');
// HTTPS
define('HTTPS_SERVER', 'https://www.site.com/admin/');
define('HTTPS_CATALOG', 'https://www.site.com/');
define('HTTPS_IMAGE', 'https://www.site.com/image/');
// DIR
define('DIR_APPLICATION', '/home/site/domains/site.com/public_html/admin/');
define('DIR_SYSTEM', '/home/site/domains/site.com/public_html/system/');
define('DIR_DATABASE', '/home/site/domains/site.com/public_html/system/database/');
define('DIR_LANGUAGE', '/home/site/domains/site.com/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/site/domains/site.com/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/site/domains/site.com/public_html/system/config/');
define('DIR_IMAGE', '/home/site/domains/site.com/public_html/image/');
define('DIR_CACHE', '/home/site/domains/site.com/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home/site/domains/site.com/public_html/download/');
define('DIR_LOGS', '/home/site/domains/site.com/public_html/system/logs/');
define('DIR_CATALOG', '/home/site/domains/site.com/public_html/catalog/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'xxxxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'xxxxxxxx');
define('DB_PREFIX', 'oc');
?>
Thanks for taking a look.
Matt
Other than that, I don't see any other errors.
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Code: Select all
2016-05-04 7:43:02 - PHP Unknown: mysql_query(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /usr/home/site/domains/site.com/public_html/vqmod/vqcache/vq2-catalog_controller_common_footer.php on line 29
2016-05-04 7:43:02 - PHP Warning: mysql_query(): Access denied for user ''@'localhost' (using password: NO) in /usr/home/site/domains/site.com/public_html/vqmod/vqcache/vq2-catalog_controller_common_footer.php on line 29
Matt
shop/vqmod/vqcache/vq2-catalog_controller_common_footer.php
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Code: Select all
<?php class ControllerCommonFooter extends Controller { protected function index() { $this->language->load('common/footer');
$this->load->model('catalog/creator');
$this->data['forms'] = $this->model_catalog_creator->getActiveForms();
$this->data['text_information'] = $this->language->get('text_information'); $this->data['text_service'] = $this->language->get('text_service'); $this->data['text_extra'] = $this->language->get('text_extra'); $this->data['text_contact'] = $this->language->get('text_contact'); $this->data['text_return'] = $this->language->get('text_return'); $this->data['text_sitemap'] = $this->language->get('text_sitemap'); $this->data['text_manufacturer'] = $this->language->get('text_manufacturer'); $this->data['text_voucher'] = $this->language->get('text_voucher'); $this->data['text_affiliate'] = $this->language->get('text_affiliate'); $this->data['text_special'] = $this->language->get('text_special'); $this->data['text_account'] = $this->language->get('text_account'); $this->data['text_order'] = $this->language->get('text_order'); $this->data['text_wishlist'] = $this->language->get('text_wishlist'); $this->data['text_newsletter'] = $this->language->get('text_newsletter'); $this->load->model('catalog/information');
error_reporting(0);
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . DB_PREFIX . "company_details' "))==1){
//richsnippets code start
$this->load->model('richsnippets/richsnippets');
$result[]= $this->model_richsnippets_richsnippets->ShowCompanyDetails();
if(!empty($result[0])){
foreach ($result as $results) {
$this->data['detail'][] = array(
'id' => $results['id'],
'company_name' => $results['company_name'],
'company_country' => $results['company_country'],
'company_region' => $results['company_region'],
'company_locality' => $results['company_locality'],
'company_postal_code' => $results['company_postal_code'],
'company_address' => $results['company_address'],
'company_tel' => $results['company_tel'],
'company_logo' => $results['company_logo'],
'company_email' => $results['company_email'],
'company_duns' => $results['company_duns'],
'company_gln' => $results['company_gln'],
'company_isicv4' => $results['company_isicv4'],
'company_naics' => $results['company_naics'],
'company_language' => $results['company_language'],
'company_lati' => $results['company_lati'],
'company_long' => $results['company_long'],
'position' => $results['position']
);
}
}
}
//richsnippets code end
$this->data['informations'] = array(); foreach ($this->model_catalog_information->getInformations() as $result) { if ($result['bottom']) {
if (($result['sort_order'] < 0) || ($result['sort_order'] >= 1000)) { continue; }
$this->data['informations'][] = array( 'title' => $result['title'], 'href' => $this->url->link('information/information', 'information_id=' . $result['information_id']) ); } } $this->data['contact'] = $this->url->link('information/contact'); $this->data['return'] = $this->url->link('account/return/insert', '', 'SSL'); $this->data['sitemap'] = $this->url->link('information/sitemap'); $this->data['manufacturer'] = $this->url->link('product/manufacturer'); $this->data['voucher'] = $this->url->link('account/voucher', '', 'SSL'); $this->data['affiliate'] = $this->url->link('affiliate/account', '', 'SSL'); $this->data['special'] = $this->url->link('product/special'); $this->data['account'] = $this->url->link('account/account', '', 'SSL'); $this->data['order'] = $this->url->link('account/order', '', 'SSL'); $this->data['wishlist'] = $this->url->link('account/wishlist', '', 'SSL'); $this->data['newsletter'] = $this->url->link('account/newsletter', '', 'SSL'); $this->data['powered'] = sprintf($this->language->get('text_powered'), $this->config->get('config_name'), date('Y', time())); if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/footer.tpl')) { $this->template = $this->config->get('config_template') . '/template/common/footer.tpl'; } else { $this->template = 'default/template/common/footer.tpl'; } $this->render(); } } ?>
I figured... DB Access in the footer section
Ernie
PS, I could not help you, when it comes to such DB Stuff, it's just not my thing, sorry.
Code: Select all
if(mysql_num_rows(mysql_query("SHOW TABLES LIKE '" . DB_PREFIX . "company_details' "))==1){
//richsnippets code start
$this->load->model('richsnippets/richsnippets');
$result[]= $this->model_richsnippets_richsnippets->ShowCompanyDetails();
---
---
---
}
//richsnippets code end
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
That's all I can tell you on this...
Good Luck!
Ernie
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/website/website.com/system/database/mysql.php on line 6.
Any one know how to solved this?
This my config (front) :
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://website.com/');
define('HTTP_IMAGE', 'http://website.com/image/');
define('HTTP_ADMIN', 'http://website.com/admin/');
define('HTTP_TEMPLATE', 'http://website.com/catalog/view/theme/');
// HTTPS
define('HTTPS_SERVER', 'http://website.com/');
define('HTTPS_IMAGE', 'http://website.com/image/');
// DIR
define('DIR_APPLICATION', '/home/website/website.com/catalog/');
define('DIR_SYSTEM', '/home/website/website.com/system/');
define('DIR_DATABASE', '/home/website/website.com/system/database/');
define('DIR_LANGUAGE', '/home/website/website.com/catalog/language/');
define('DIR_TEMPLATE', '/home/website/website.com/catalog/view/theme/');
define('DIR_CONFIG', '/home/website/website.com/system/config/');
define('DIR_IMAGE', '/home/website/website.com/image/');
define('DIR_CACHE', '/home/website/website.com/system/cache/');
define('DIR_DOWNLOAD', '/home/website/website.com/download/');
define('DIR_LOGS', '/home/website/website.com/system/logs/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'xxxxxxxxxx');
define('DB_USERNAME', 'xxxxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'xxxxxxxxxx');
define('DB_PREFIX', '');
?>
Code: Select all
<?php
// HTTP
define('HTTP_SERVER', 'http://website.com/bkmanagement/');
define('HTTP_CATALOG', 'http://website.com/');
// HTTPS
define('HTTPS_SERVER', 'http://website.com/bkmanagement/');
define('HTTPS_CATALOG', 'http://website.com/');
// DIR
define('DIR_APPLICATION', '/home/website/website.com/bkmanagement/');
define('DIR_SYSTEM', '/home/website/website.com/system/');
define('DIR_DATABASE', '/home/website/website.com/system/database/');
define('DIR_LANGUAGE', '/home/website/website.com/bkmanagement/language/');
define('DIR_TEMPLATE', '/home/website/website.com/bkmanagement/view/template/');
define('DIR_CONFIG', '/home/website/website.com/system/config/');
define('DIR_IMAGE', '/home/website/website.com/image/');
define('DIR_CACHE', '/home/website/website.com/system/cache/');
define('DIR_DOWNLOAD', '/home/website/website.com/download/');
define('DIR_LOGS', '/home/website/website.com/system/logs/');
define('DIR_CATALOG', '/home/website/website.com/catalog/');
// DB
define('DB_DRIVER', 'mmysqli');
define('DB_HOSTNAME', 'xxxxxxxxxx');
define('DB_USERNAME', 'xxxxxxxxxx');
define('DB_PASSWORD', 'xxxxxxxxxx');
define('DB_DATABASE', 'xxxxxxxxxx');
define('DB_PREFIX', '');
?>
Code: Select all
// DB
define('DB_DRIVER', 'mysql');
// DB
define('DB_DRIVER', 'mmysqli');
My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.
Users browsing this forum: No registered users and 60 guests