webERP Forum

Full Version: Database Error 1064 in PO_Items.php
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

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);

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.

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 ";

Hi Tim,

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


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

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.

Ah that explains it, thanks Andy

Reference URL's