Question
Wildcard in MySQL Query - Part 2
Thank's David.
Worked a treat. The key was uisng LIKE not =
However, while it works on the events page, when I try and do the same thing on a similar page, but for a different table, I have the following problem...
The SQL works fine, but as soon as I try and access the database from the page (i.e. using live data view of running the page on the website), i get the following error:
Fatal error: Call to undefined function: getsqlvaluestring() in /home/sites/enagri.info/public_html/enagri_info/news/#pagename# on line #line no.#
The line in question reads:
$query_rsNews = sprintf("SELECT newsDate, newsHeadline, newsLink, newsLocation, newsCategory FROM news WHERE newsLocation LIKE %s ORDER BY newsDate DESC", GetSQLValueString($location_rsNews, "text"));
Is this anthything to do with the fact that the values in the location table are integers and not text? However, it doesn't seem to be putting this code on the events page?
Any ideas?
P.S. - Haven't posted this a reply as when I try my browser keeps crashing.
P.P.S. - David, wasn't trying to say I didn't want to learn, but as a newbie, there's no halfway house. It sometimes seems that you end up having to learn adanced SQL from manuals that don't make sense, for a simple 4-line query...
🙂
Worked a treat. The key was uisng LIKE not =
However, while it works on the events page, when I try and do the same thing on a similar page, but for a different table, I have the following problem...
The SQL works fine, but as soon as I try and access the database from the page (i.e. using live data view of running the page on the website), i get the following error:
Fatal error: Call to undefined function: getsqlvaluestring() in /home/sites/enagri.info/public_html/enagri_info/news/#pagename# on line #line no.#
The line in question reads:
$query_rsNews = sprintf("SELECT newsDate, newsHeadline, newsLink, newsLocation, newsCategory FROM news WHERE newsLocation LIKE %s ORDER BY newsDate DESC", GetSQLValueString($location_rsNews, "text"));
Is this anthything to do with the fact that the values in the location table are integers and not text? However, it doesn't seem to be putting this code on the events page?
Any ideas?
P.S. - Haven't posted this a reply as when I try my browser keeps crashing.
P.P.S. - David, wasn't trying to say I didn't want to learn, but as a newbie, there's no halfway house. It sometimes seems that you end up having to learn adanced SQL from manuals that don't make sense, for a simple 4-line query...
🙂
