I’m confused. I’ve been working with several websites that display dynamic pages for several years with no problem - except I haven’t been keeping up with the latest PHP/MySQL versions.
I just upgraded to a new Mac with a new operating system (LION), along with the current version of MAMP, which automatically upgraded PHP and MySQL.
Now my simplest database queries don’t work…
$result = mysql_result(mysql_query("SELECT COUNT(URL)
FROM gs
WHERE URL = '$MyURL'"),0);
…where $MyURL is a place name, like “France.” In other words, I’m trying to display a page at MySite/World/France, MySite/World/Cuba, etc.
But instead I get an error message:
Warning: mysql_result() expects parameter 1 to be resource, boolean given in /Users/myname/Sites/MySite/inc/B/DB/Child/World.php on line 38
I pasted my query into phpMyAdmin’s SQL window, and it said I have a syntax problem. So it looks like I need to go back to square one and learn how to write basic database queries.
This is a very simple query. All I want to do is figure out if a particular URL is in my database table. If I type in MySite/World/Spain, it will then fetch additional files that display content. If I type in MySite/World/Spam, it will instead fetch a 404 error page.
I think there’s a name for this type of query, though I can’t remember what it is. Anyway, can anyone tell me the best way to do what I’m trying to do?
Thanks.
P.S. These are my current software versions:
Apache 2.2.21, PHP 5.3.6, MySQL 5.5.9