SMF Shop

SMFShop => Bugs => Topic started by: JusPlay77 on February 29, 2008, 05:36:49 pm

Title: [ SERIOUS ISSUES WITH pet_engine.php ]
Post by: JusPlay77 on February 29, 2008, 05:36:49 pm
SMF 1.1.4
SMF Shop Mod 3 (Build 12)
SMF Pets Version 0.2
SMFShop Inventory Post Mod  Version 0.2
SMFShop Stats Mod Version 0.1

\---------------------\

My shop all of a sudden stopped working over night.  I hadn't changed anything in the code prior (It was working, and when I came back to further train my pet I got the following error:

Quote
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 's the best! Built for Battle!',
hunger = 8,
age = 1,
' at line 7
File: /home/content/x/x/x/xxxxx/html/smf/Sources/shop/pet_engine.php
Line: 305

On top of that, my pet is somehow 21 days old and Very Depressed / Starving.  (I can still see my pet through my UserCP). My pet in actuality is only 2-3 days old.

I have attached the code of the pet_engine.php to this thread:

----

Furthermore, the section that it says it has a problem with is here:

Code: [Select]
290 //Store the values back into the database(very important)
291 function store_values() {
292 global $db_prefix;
293 $result = db_query("UPDATE {$db_prefix}shop_pets
294 SET name = '{$this->name}',
295     level = {$this->level},
296     curap = {$this->curap},
297     maxap = {$this->maxap},
298     happy = {$this->happy},
299     `desc` = '{$this->desc}',
300     hunger = {$this->hunger},
301     age = {$this->age},
302     training = {$this->training},
303     trainingend = '{$this->trainingend}',
304     ownerid = {$this->ownerid}
305     WHERE pet_id = {$this->id}", __FILE__, __LINE__);
306 }

Thanks in advance 
Title: Re: [ SERIOUS ISSUES WITH pet_engine.php ]
Post by: JusPlay77 on March 01, 2008, 06:48:29 am
This is what my db looks like.. dunno if there is anything missing?  or if something extra needs to be done to it or the php code? 

(http://img442.imageshack.us/img442/9918/sqlmx0.png)



If anyone knows how to fix this, please respond.- This error is affecting my entire Shop-- nothing works with this error in play
Title: Re: [ SERIOUS ISSUES WITH pet_engine.php ]
Post by: Faust on March 02, 2008, 12:10:42 pm
Is this the description of your pet ?

Quote
near 's the best! Built for Battle!

because if it is, then that is the problem, the ' is not properly escaped in the query, for the time being just go find your pet in the db and remove the ' in the description at near's

I am working on fixing the query