Re: Search Engine Problem
| From: | DL Neil | Date: | Thu, 25 Oct 2001 22:20:00 +0000 |
| Subject: | Re: Search Engine Problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-10038@lists.php.net to get a copy of this message | ||
I am using this piece of code to display news articles based on the variables inputted by a user.
However, it will only
display one article, never more, even if more are within the terms of the "WHERE" clause.
What am I doing wrong?
$search = mysql_query("SELECT news.ID, newstitle, newsdescription, newsdate, author, email FROM
news, authors WHERE
$name LIKE '%$value%' AND authors.ID=AID ORDER BY news.ID DESC");
if (!search) {
echo("<p>Sorry, there are no matches for what you are looking for. Please try
again</p>");
exit();
}
Mark,
This piece of code interrogates MySQL and responds with a "result identifier resource" or
ResourceSet or ResultSet or
RecordSet, depending upon your terminology. How do you thereafter 'unpack' the rows from
the resource set - using for eg
mysql_fetch_assoc()? (else see manual)
Have you tried copying that SELECT statement (substituting values appropriately) and running it
under native SQL or in a
'management tool', to be sure it actually works (regardless of PHP)?
Regards,
=dn