greasemonkey Posted September 16, 2013 Posted September 16, 2013 I have a very old addon that someone wrote for me years ago to update my inventory. It uses a mysql connection and is failing all over the place with my recent upgrade from 2.3.3.1 to 2.3.3.2. I would like to make sure this addon can continue to be used - and so therefore understand it must be updated to use teb_db, however, I have zero idea how to accomplish this... Is this something easily accomplished by a non-coder (I'm ok... but have no where near the skill you guys do...)? Or do I need to hire a professional? The errors are; Warning: mysql_query() [function.mysql-query]: Access denied for user '*****'@'localhost' (using password: NO) in /home/*****/public_html/admin/inventory_update.php on line 66 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/*****/public_html/admin/inventory_update.php on line 66 Warning: mysql_query() [function.mysql-query]: Access denied for user '*****'@'localhost' (using password: NO) in /home/*****/public_html/admin/inventory_update.php on line 161 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/*****/public_html/admin/inventory_update.php on line 161 Line 66 is; mysql_query($empty_table); and 161 is; mysql_query($query_insert) or die(mysql_error()."<br>".$query_insert."<br>".$category_failed.":".$manufacture_failed); There are many other occurrences of mysql in the file... I'm not sure where to start however. I've tried just swapping our via find and replce to teb_db... but no go.
tgely Posted September 17, 2013 Posted September 17, 2013 It looks like simple, but I dont see the program logic. change mysql_query($empty_table); to: tep_db_query($empty_table); change: mysql_query($query_insert) or die(mysql_error()."<br>".$query_insert."<br>".$category_failed.":".$manufacture_failed); to: tep_db_query($query_insert); osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.
burt Posted September 17, 2013 Posted September 17, 2013 @@greasemonkey it is as @@Gergely says, basically scan thru your code and everywhere you see mysql_* change it to tep_db_* Eg; mysql_fetch_array becomes tep_db_fetch_array mysql_query becomes tep_db_query and so on. That should do it, but there may be some mysql_* queries that it won't work for, but most likely these ones would not be part of your code anyway. Have a look at the following file; /includes/classes/database.php and you'll see the tep_* which call the mysql_* When these are set up as a function, it is the function that is called in many pages in osCommerce. So when the code needs updating as in the case from mysql to mysqli, it can be done in just 1 location, which is then used all over the shop. Imagine if there were 300 places you had to change some code to deal with the mysql to mysqli change.... Make sense ?
greasemonkey Posted September 17, 2013 Author Posted September 17, 2013 Ok, making progress... @@burt, this file is in admin, so I presume you mean admin/includes/functions/database.php. I have changed all occurences of mysql_query to tep_db_query... same for num_rows and insert_id. I was confused what to do with mysql_fetch_object because I couldn't find it in admin/includes/functions/database.php so I added the function to the database.php and change to tep_db_; //inventory update function tep_db_fetch_object($db_query) { return mysqli_fetch_object($db_query); } Is this right??? I'm no longer getting the Warning: mysql_query... However, I'm now getting a syntax error 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE categories_id = 165' at line 2 UPDATE categories SET parent_id = WHERE categories_id = 165 I have to occurences of UPDATE categories SET parent_id like below... any ideas???? $query_update_parent = "UPDATE categories SET parent_id = ".$all_categories[$categories_row->Category]." WHERE categories_id = ".$check_row->categories_id; tep_db_query($query_update_parent);
tgely Posted September 17, 2013 Posted September 17, 2013 $query_update_parent = "UPDATE categories SET parent_id = ".$all_categories[$categories_row->Category]." WHERE categories_id = ".$check_row->categories_id.""; tep_db_query($query_update_parent); osCommerce based shop owner with minimal design and focused on background works. When the less is more.Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.