[SGVLUG] A puzzling PHP / MySQL problem.

Robert Leyva mrflash818 at geophile.net
Thu Feb 1 08:39:16 PST 2007


What happens if you add a semi-colon to the end of your query string?

SELECT eventID, venueID, title, summary, eventType, eventSubtype,
eventStartDate, eventStartTime, admissionPrice FROM events WHERE (title
LIKE '%a%') ORDER BY title ASC;

Also, you may have to escape the single quotes in that string in order to
be correctly interpreted?


> Good evening all,
>
> The following query results in a mysql error if executed by PHP but
> succeeds if entered into the SQL window of phpMyAdmin:
>
> SELECT eventID, venueID, title, summary, eventType, eventSubtype,
> eventStartDate, eventStartTime, admissionPrice FROM events WHERE (title
> LIKE '%a%') ORDER BY title ASC
>
> ERROR 1: 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 '' at line 1.
>
> The server is an iMac OS 10.3.9, MySQL 5.0.16-standard, PHP Version
> 5.0.4.
>
> Peter -
>
>


-- 
"Knowledge is Power" -- Francis Bacon

Robert Leyva
mrflash818 at geophile.net



More information about the SGVLUG mailing list