a simple Mysql php search engine - doesn't work - need help
Posted: Sun Mar 13, 2005 11:04 am
It automatically just displays the first line out of the table and that's it, i can't search, nuthing!
feyd | Please use
Code: Select all
<?php
require("config.php");
echo"
<form action=\"$_PHPSELF\" method=\"post\">
<input type=\"text\" name=\"searchterm\"><br/>
<input type=\"Submit\" value=\"Update\">
</form>";
$searchterm = $_GET['searchterm'];
$query = "SELECT content, title FROM pages WHERE content LIKE '%$searchterm%' OR title LIKE '%$searchterm%'";
$result = mysql_query($query);
if (!isset($_GET['submit']))
{
$row = mysql_fetch_array($result);
$content = $row['content'];
$title = $row['title'];
echo "$content";
echo "$title";
}
else {
echo "standard";
}
?>feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]