I came up with my own search script the one found on the link above didn't quite worked for me, but still have a problem... and is that no matter what I search for I'm getting the whole content of the table back and the problem is on the sql string which I'm using
Code:
SELECT * FROM articles
and I realize that I should be using some sort of condition on my sql statement to match the user search, but I can put it into php terms if someone could give a hand....here the php code
PHP Code:
<?php
//open connection
$conn = mysql_connect("localhost", "root", "password") or die(mysql_error());
//select database
mysql_select_db("test", $conn);
//the sql statement
$sql = "SELECT * FROM articles";
//execute the statement
$data = mysql_query($sql, $conn) or die(mysql_error());
while ($result = mysql_fetch_array($data)) {
//giving names to the fields
$title = $result['title'];
$date = $result['date'];
$info = $result['info'];
$url = $result['url'];
//put the results on the screen
echo "<b>$title</b>";
echo " ";
echo "<b>$date</b><br>";
echo "$info<br>";
echo "$url<br>";
}
?>
and here is the search form
Code:
<h2>Search</h2>
<form name="search" method="post" action="search1.php">
Seach for: <input type="text" name="find" />
<input type="submit" name="search" value="Search" />
</form>
thanks
www.pctechtips.org