Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Error in My SQL


6 replies to this topic

#1 myebooksbuddy

  • Community Member
  • 8 posts
  • Real Name:Ashok
  • Gender:Male
  • Location:Mumbai,India

Posted 13 May 2010, 12:14

The View Orders in the Admin of my store shows This 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 '-20, 20' at line 1

My question is how do I rectify this and where can I access this files.

Thanks in advance.

Ashok

Edited by myebooksbuddy, 13 May 2010, 12:17.


#2 MrPhil

  • Community Member
  • 3,291 posts
  • Real Name:Phil
  • Gender:Male

Posted 13 May 2010, 14:28

You are using a very old version of osC. Recent releases have the fix in split_page_results.php (both regular and admin). Change admin/includes/classes/split_page_results.php from
sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
to
sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
and includes/classes/split_page_results.php from
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
to
$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;


#3 myebooksbuddy

  • Community Member
  • 8 posts
  • Real Name:Ashok
  • Gender:Male
  • Location:Mumbai,India

Posted 14 May 2010, 09:12

View PostMrPhil, on 13 May 2010, 14:28, said:

You are using a very old version of osC. Recent releases have the fix in split_page_results.php (both regular and admin). Change admin/includes/classes/split_page_results.php from
sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
to
sql_query .= " limit " . max($offset, 0) . ", " . $max_rows_per_page;
and includes/classes/split_page_results.php from
$this->sql_query .= " limit " . $offset . ", " . $this->number_of_rows_per_page;
to
$this->sql_query .= " limit " . max($offset, 0) . ", " . $this->number_of_rows_per_page;



Thank you Mr. Phil for your prompt reply.

But further, I have to state that, this error is on my live site which went live very recently. But I would like to know whether I can change the osC to latest version since, as you say, this is very old version. At present I am facing problems in delivery to customers also.
If yes, I can; then I would need help in replacing it.

Your help is much appreciated. :rolleyes:

Regards,

Ashok

Edited by Jan Zonjee, 14 May 2010, 10:58.


#4 MrPhil

  • Community Member
  • 3,291 posts
  • Real Name:Phil
  • Gender:Male

Posted 14 May 2010, 17:56

It sounds like you're at pre-2.2 MS2, and the latest is 2.2 RC2a. If you have any customization or add-ons in the code (such as you purchased a template or packaged store based on a very old osC version), it will be a lot of work to update the code to current levels. If your store is unmodified, just very old, I would back up your database, install 2.2 RC2a, and restore your database products into the new database. Note that there have been some database structure changes over the years, so you may be best off importing your data, rather than trying to patch the old database to match the new schema. It's still a tricky process, as you want to only bring over product entries and customers, without messing up settings, etc. It can be done, but requires an understanding of what data should be left from a new install, and what should be brought in from the old store.

Or, you can choose to keep the old version, and just patch it as problems arise. They will arise, as hackers exploit security holes in the code, and your host upgrades MySQL and PHP versions. You have to look at how much customization has been done to the store, and whether it's worth trying to transfer it to the latest osC version, or manually upgrading the old code to match the new.

If you just purchased a packaged store from someone, and the base code version is not 2.2 RC2a, I would demand that they upgrade for free or refund your money. You were royally ripped off if someone just sold you a store still running 2.2 MS1 or earlier as its core.

#5 myebooksbuddy

  • Community Member
  • 8 posts
  • Real Name:Ashok
  • Gender:Male
  • Location:Mumbai,India

Posted 15 May 2010, 08:27

Yes Phil, it was, as you say, the royal rip-off but it was non-refundable and I am stuck.It was a packaged store loaded with e-books, software & graphics for sale.

It went live just recently and when I was testing that this things came to light. So there are no customer records. Only Product database will need to be transferred / brought from the old database.

If you are willing to help me out, pl. quote your compensation amount and the time required to complete the entire process. I may also need your guidance in configuartion of the store although I had done all configuration in the first store.

I have also some plans to integrate a number of things in the same store, which I found lacking in old version store. But we can talk about that later once this store is up and running.

Pl. quote your reasonable amount so that I can decide whether to convert it into new version store or to just dump it.

Thanks Mr.Phil again.

#6 MrPhil

  • Community Member
  • 3,291 posts
  • Real Name:Phil
  • Gender:Male

Posted 15 May 2010, 23:33

Well, that looks like it's going to be quite a bit of work, and I'm (fortunately for me, unfortunately for you) fairly busy right now. Hopefully someone else near you can quote you a reasonable price.

Has the store itself been heavily customized with templates, etc., or can you tell if it is pretty much "stock" osC? If it's basically a vanilla installation, just preloaded with merchandise and your logo, you ought to be able to replace it with a vanilla 2.2 RC2a installation, preserving your product data. But, without being able to take the time to look at what you've got, I really can't tell you how much work it will be. I would hope that the seller was keeping up to date with most osC code changes (the code is more or less compatible with 2.2 RC2a) but just overlooked that $offset fix.

Assuming it's a very old version of osC, if you stay in it and just try to patch problems as they arise, you will have a number of problems eventually, as your host upgrades PHP and MySQL. First, register global variables will be shut off by default (easy to turn back on), but eventually they will be gone for good. Certain built-in things like "long array names" (e.g., $HTTP_POST_VARS) will be removed from PHP 5. Recent versions of osC have a "compatibility layer" to replace them if they're not defined, or you can go through and replace $HTTP_POST_VARS by $_POST (as well as for a number of other system variables). PHP 5 won't let you do: $this = null;. PHP 5.3 will start giving annoying warning messages about "deprecated functions" being removed, but 2.2 RC2a has that problem too. MySQL 5 will require some PHP code changes for compatibility. Finally, there are many security holes that have been patched in 2.2 RC2a, and many more that you need to do yourself.

If you're not handy with PHP and maintaining a site, this work may well be overwhelming for you. In a few months I will probably be freed up enough to work on it, but if you can't wait that long, I hope you can find someone.

#7 myebooksbuddy

  • Community Member
  • 8 posts
  • Real Name:Ashok
  • Gender:Male
  • Location:Mumbai,India

Posted 17 May 2010, 06:28

Hi Mr.Phil,

Thanks for elaborating on different parameters entailed in the changeover.

So nice of you to have solved my first problem.

Thanks for your guidance and help.

Ashok

Edited by Jan Zonjee, 18 May 2010, 20:13.