Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Database Error 1064 in PO_Items.php
05-15-2017, 09:55 PM
Post: #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.
Find all posts by this user
Quote this message in a reply
05-16-2017, 12:01 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
05-16-2017, 12:27 AM
Post: #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.
Find all posts by this user
Quote this message in a reply
05-16-2017, 02:10 AM
Post: #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
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)