Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Error 1064 in PO_Items.php
05-15-2017, 09:55 PM,
#1
Database Error 1064 in PO_Items.php
I receive the following error when searching for an item by description, while creating a purchase order in PO_Items.php:

Database Error 1064 : There is a problem selecting the part records to display because
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 '50 OFFSET 0' at line 16
Database SQL Failure : The SQL statement that failed was
SELECT stockmaster.stockid, stockmaster.description, stockmaster.units FROM stockmaster INNER JOIN stockcategory ON stockmaster.categoryid=stockcategory.categoryid INNER JOIN purchdata ON stockmaster.stockid=purchdata.stockid WHERE (stockmaster.mbflag<>'D' OR stockcategory.stocktype='L') AND stockmaster.mbflag<>'K' AND stockmaster.mbflag<>'A' AND stockmaster.mbflag<>'G' AND stockmaster.discontinued<>1 AND purchdata.supplierno='ALB01' AND stockmaster.description LIKE '%spring%' GROUP BY stockmaster.stockid ORDER BY stockmaster.stockidLIMIT 50 OFFSET 0


I am running webERP 4.13.1, with PO_Items.php version 4183 (standard).

PHP 5.6.30
MySQL Community Server (GPL) 5.5.54
Apache/2.4.23 (Unix)

Searching for an item by description in SelectProducts.php is successful and does not produce the same symptom.

Any ideas on what could be causing this?

Thanks in advance.

Andy.
https://www.linkedin.com/in/andrewcouling
Reply
05-16-2017, 12:01 AM,
#2
RE: Database Error 1064 in PO_Items.php
Hi Andy,

Line 1094 (approx) reads:

$sql = $sql . "LIMIT " . $_SESSION['DisplayRecordsMax']." OFFSET " . strval($_SESSION['DisplayRecordsMax']*$Offset);

it should read

$sql = $sql . " LIMIT " . $_SESSION['DisplayRecordsMax']." OFFSET " . strval($_SESSION['DisplayRecordsMax']*$Offset);

Thanks
Tim
Reply
05-16-2017, 12:27 AM,
#3
RE: Database Error 1064 in PO_Items.php
Hi Tim,

Thanks for that. It's fixed now.

As that script has been unchanged for quite some time, I have to assume that its something about my setup which is perhaps more sensitive to that kind of 'typo'.

I will submit your fix.

Andy.
https://www.linkedin.com/in/andrewcouling
Reply
05-16-2017, 02:10 AM,
#4
RE: Database Error 1064 in PO_Items.php
It will only occur when the stock category is set to "All", and "Only items defined as from this Supplier" is ticked, and something is entered in the description box, but not the item code box.

Actually looking at it, to be consistent with the rest of the code line 875 should be changed to:
ORDER BY stockmaster.stockid ";

Thanks
Tim
Reply
09-12-2017, 12:58 AM,
#5
RE: Database Error 1064 in PO_Items.php
Hi Tim,

Both of these mods to PO_Items.php have been committed to the trunk.

Thanks,

Andy.
https://www.linkedin.com/in/andrewcouling
Reply
09-12-2017, 06:14 AM,
#6
RE: Database Error 1064 in PO_Items.php
Thanks for that Andy.

BTW one of your subversion comments mentioned a "Tims fork". Was that another Tim or do I have a fork I am unaware of? Smile

Tim
Reply
09-12-2017, 06:35 AM,
#7
RE: Database Error 1064 in PO_Items.php
Hi Tim,

I can't claim that change note to be my own.
Phil very kindly committed some of the Petty Cash scripts that you and I have been working on.

Andy.
https://www.linkedin.com/in/andrewcouling
Reply
09-12-2017, 03:35 PM,
#8
RE: Database Error 1064 in PO_Items.php
Ah that explains it, thanks Andy

Tim
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)