This topic is locked
[SOLVED]

 Error 256

5/13/2011 2:43:38 PM
PHPRunner General questions
hfg author

I have been running into Error 256 since upgrade some of my projects to PHPR 5.2 and 5.3. It is almost always as follows:
Error type 256

Error description Unknown column '' in 'where clause'
It normally happens on the Export, Print and sometime Edit or Add. In the most recent case it was Export and Print. The List page is not any issue.
I did not make any changes to the part of the project that is having the issue in the process of upgrading it and it worked fine under 5.1. It seems to have to do with the SQL statement (the sub-queries?)
This is the current statement (NOTE_ID is the key, I added Cust_ID as well but that did not help):



select

Note_ID,

Cust_ID,

`Date`,

`Comment`,

Salesperson,

Appt_Date,

Appt_Hour,

Appt_Minute,

Appt_Result,

Appt_Comment,

Appt_Type,

Concat((select customer.FName from customer where notes.Cust_ID = customer.ID), ', ', (select customer.LName from customer where notes.Cust_ID = customer.ID)) AS Customer,

(select customer.Home_Phone from customer where notes.Cust_ID = customer.ID) AS HomePhone,

Note_Lot,

DATEDIFF(NOW(), Appt_Date) AS Age,

(Select Status from customer where customer.ID = notes.Cust_ID) AS Status,

(Select No_Buy_Reason from customer where customer.ID = notes.Cust_ID) AS No_Buy_Reason,

(Select Email from customer where customer.ID = notes.Cust_ID) AS Email,

'' AS sendemail,

(CASE

WHEN Appt_Hour = '07 (AM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 7:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' AM')

WHEN Appt_Hour = '08 (AM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 8:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' AM')

WHEN Appt_Hour = '09 (AM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 9:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' AM')

WHEN Appt_Hour = '10 (AM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 10:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' AM')

WHEN Appt_Hour = '11 (AM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 11:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' AM')

WHEN Appt_Hour = '12 (Noon)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 12:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '13 (1 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 1:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '14 (2 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 2:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '15 (3 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 3:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '16 (4 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 4:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '17 (5 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 5:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '18 (6 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 6:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '19 (7 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 7:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '20 (8 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 8:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '21 (9 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 9:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

WHEN Appt_Hour = '22 (10 PM)' THEN concat(DATE_FORMAT(Appt_Date, '%W %M %d, %Y'), ' at 10:', (IF(Appt_Minute is null,'00',Appt_Minute)), ' PM')

END) AS Appt_Text,

(Select FName from Customer where Cust_ID = ID) AS Name,

(Select LName from Customer where Cust_ID = ID) AS LastName,

(Select Street from Customer where Cust_ID = ID) AS Street,

(Select Street2 from Customer where Cust_ID = ID) AS Street2,

(Select City from Customer where Cust_ID = ID) AS City,

(Select `State` from Customer where Cust_ID = ID) AS St,

(Select Zip from Customer where Cust_ID = ID) AS Zip

FROM notes

WHERE Appt_Date <= CURDATE() AND Appt_Result = ''

ORDER BY Appt_Date DESC, Appt_Hour, Appt_Minute
Sergey Kornilov admin 5/14/2011

I would suggest to post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

hfg author 5/16/2011

I fixed the issue by getting rid of the sub-queries and using an inner join.
Any idea why the sub-queries would case issues that the inner join does not? I have other projects where I have run into similar issues and are not as easily solved as the sub-query works better in those cases.
FYI this is a mysql based project.

Sergey Kornilov admin 5/16/2011

Unfortunately we cannot provide any reasonable advice until we see what exactly causes the trouble.