This topic is locked

PHP error happened

4/18/2008 7:10:22 AM
PHPRunner General questions
T
thesofa author

I am getting this error when I try to open the list page, based on a custom view

Error type 256

Error description 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 '='167')' at line 1

URL intranet/staff/detest/v_det_by_tut_list.php?

Error file E:\wwwroot\Intranet\staff\detest\include\dbconnection.php

Error line 26

SQL query select detentions.DayForDetention, detentions.Sess, detentions.Department, detentions.Done, detentions.MoveToHOD, detentions.OriginalDate, detentions.DoneAtDept, detentions.DatewithHOD, nd_pupils.ID_pup, concat(nd_pupils.Surname, " ", nd_pupils.Forename) AS Student, concat(left(nd_staff.firstname, 1), " ", nd_staff.lastname) AS `Run By`, concat(left(nd_staff1.firstname, 1), " ", nd_staff1.lastname) AS `Given By`, detentions.DateGiven, detentions.Date2SLT, detentions.ID, reasons.reason FROM detentions INNER JOIN nd_pupils ON detentions.Detainee = nd_pupils.ID_pup INNER JOIN nd_staff ON detentions.Owner = nd_staff.userid INNER JOIN reasons ON detentions.Reason = reasons.idReason INNER JOIN nd_staff AS nd_staff1 ON detentions.Origin = nd_staff1.userid where (detentions.Done =0 ) and (='167') ORDER BY detentions.Owner

Solution This is a general error. It occurs when there is an error in event code or in SQL.

J
Jane 4/18/2008

Hi,
please post SQL query of this view.

T
thesofa author 4/18/2008

Hi,

please post SQL query of this view.


select

detentions.DayForDetention,

detentions.Sess,

detentions.Department,

detentions.Done,

detentions.MoveToHOD,

detentions.OriginalDate,

detentions.DoneAtDept,

detentions.DatewithHOD,

nd_pupils.ID_pup,

concat(nd_pupils.Surname, " ", nd_pupils.Forename) AS Student,

concat(left(nd_staff.firstname, 1), " ", nd_staff.lastname) AS `Run By`,

concat(left(nd_staff1.firstname, 1), " ", nd_staff1.lastname) AS `Given By`,

detentions.DateGiven,

detentions.Date2SLT,

detentions.ID,

reasons.reason

FROM detentions

INNER JOIN nd_pupils ON detentions.Detainee = nd_pupils.ID_pup

INNER JOIN nd_staff ON detentions.Owner = nd_staff.userid

INNER JOIN reasons ON detentions.Reason = reasons.idReason

INNER JOIN nd_staff AS nd_staff1 ON detentions.Origin = nd_staff1.userid

WHERE detentions.Done =0

ORDER BY detentions.Owner
the (=`167`) at the end of the error message is the ID number of the user who is logged in, user security is set to users can see their own posts and edit their own posts only

Sergey Kornilov admin 4/18/2008

It looks Advanced Security mode is not setup properly.
Proceed to Advanced security screen and double-check settings there.