I tried to write a simple search script for my db, and it isn't working. Can anyone hypothsise as to why?
<? if ($submit)
{
$query = ("SELECT * FROM baileymail_articles ORDER BY id DESC");
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$article = $row['article']; $keywords = $row['keywords']; $description = $row['description']; $section = $row['section'];
$type = $row['type']; $title = $row['title'];
if (preg_match('/$search/',$article) || preg_match('/$search/','$keywords') || preg_match('/$search/','$description') || preg_match('/$search/','$section') || preg_match('/$search/','$type') || preg_match('/$search/','$title'))
{
After that I have done the code for how I one each row returned by the search to be displayed. Why doesn't it work? No error codes or anything, and I have entered words I am sure are in the tables and no results are returned.