Zen Cart Logo
Forums / Bug Reports / mysql_query

mysql_query

Views: 3,295

Results 1 to 5 of 5
21 Dec 2013, 8:10 AM
#1
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

mysql_query

Hi Guys,

I'm not sure if this is a bug or not, but I've recently been trialling V1.5.2 Beta RC1 & RC2 and both are giving a problem with any modules that use mysql_query($variable) ;

Example: The 'print' option in Super Orders

[21-Dec-2013 07:48:43 UTC] PHP Warning: mysql_query(): Access denied for user 'rod'@'localhost' (using password: NO) in /home/www/XXXXXX/super_data_sheet.php on line 195
[21-Dec-2013 07:48:43 UTC] PHP Stack trace:
[21-Dec-2013 07:48:43 UTC] PHP 1. {main}() /home/www/XXXXXX/super_data_sheet.php:0
[21-Dec-2013 07:48:43 UTC] PHP 2. mysql_query(uninitialized) /home/www/XXXXXX/super_data_sheet.php:195
[21-Dec-2013 07:48:43 UTC] PHP Warning: mysql_query(): A link to the server could not be established in /home/www/XXXXXX/super_data_sheet.php on line 195
[21-Dec-2013 07:48:43 UTC] PHP Stack trace:
[21-Dec-2013 07:48:43 UTC] PHP 1. {main}() /home/www/XXXXXX/super_data_sheet.php:0
[21-Dec-2013 07:48:43 UTC] PHP 2. mysql_query(uninitialized) /home/www/XXXXXX/super_data_sheet.php:195
[21-Dec-2013 07:48:43 UTC] PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/www/XXXXXX/super_data_sheet.php on line 196
[21-Dec-2013 07:48:43 UTC] PHP Stack trace:
[21-Dec-2013 07:48:43 UTC] PHP 1. {main}() /home/www/XXXXXX/super_data_sheet.php:0
[21-Dec-2013 07:48:43 UTC] PHP 2. mysql_fetch_array(uninitialized, uninitialized) /home/www/XXXXXX/super_data_sheet.php:196


Cross Sell Advanced for v1.5.0

[21-Dec-2013 08:07:18 UTC] PHP Warning: mysql_query() expects parameter 2 to be resource, object given in /home/www/XXXXXX/xsell.php on line 152
[21-Dec-2013 08:07:18 UTC] PHP Stack trace:
[21-Dec-2013 08:07:18 UTC] PHP 1. {main}() /home/www/XXXXXX/xsell.php:0
[21-Dec-2013 08:07:18 UTC] PHP 2. mysql_query(uninitialized, uninitialized) /home/www/XXXXXX/xsell.php:152


Any ideas for a solution?

Cheers
RodG

21 Dec 2013, 12:10 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,066
Plugin Contributions:
56

Re: mysql_query

Could it be because v1.5.2 has converted to a mysqli instead of mysql interface?

21 Dec 2013, 12:40 PM
#3
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: mysql_query

lat9:

Could it be because v1.5.2 has converted to a mysqli instead of mysql interface?

Undoubtedly.

I've fixed the problem with the mysql_query error (by replacing them with $db->execute

I'm still having a problem with the mysql_fetch_array() commands though. I've tried changing these to mysqli_fetch_array() but they are still giving errors.

Obviously I'm doing something wrong, but so far I still haven't figured out what. :(

Any ideas?

Cheers
Rod

21 Dec 2013, 12:44 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: mysql_query

isn't that done with the $db->Execute,

If I remember well from porting modules from Osc,

Qouted from http://www.zen-cart.com/wiki/index.php/Developers_-_Porting_modules_from_osC

Replace code like

$my_var_query = tep_db_query("query stuff"); $my_var = tep_db_fetch_array($my_var_query); by

$my_var = $db->Execute("query stuff");

So I guess it might work on ZC too

21 Dec 2013, 1:09 PM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: mysql_query

Problem solved.

-------- Original code example ------------------------
$result = mysql_query($query) ;

while ($datafields = mysql_fetch_array($result)) {

/// code goes here

}

-------- Modified code example --------------
$result = $db->execute($query) ;

while (!$result->EOF) {

$datafields = $result->fields ;

/// code goes here

$result->MoveNext ;
}