<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?php include 'func.inc.php'; ?>
<title>SEARCH</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h2>SEARCH</h2>
<form action="" method="post">
<p>
<input type="text" name="keywords"/> <input type="submit" value="Search"/>
</p>
</form>
<?php
if (isset ($_POST['keywords'])){
$suffix ="";
$keywords =mysql_real_escape_string(htmlspecialchars(trim($_POST['keywords'])));
$keywords =$_POST['keywords'];
$errors = array ();
if (empty ($keywords)){
$errors[] = ('Please enter a serch terms');
}else if (strlen($keywords)<3){
$errors[] = ('Your search terms must be three or more characters');
}else if (search_results ($keywords) == false){
$errors []= ('Your search for '.$keywords.' returned no results');
}
if(empty($errors)) {
$results=search_results ($keywords);
$results_num = count ($results);
$suffix = ($results_num!=1) ? 's' : '' ;
echo '<p>Your search for <strong>', $keywords, '</strong> returned <strong>', $results_num, '</strong> result', $suffix, '</p>';
foreach ($results as $result) {
echo '<p><strong>', $result ['title'], '</strong> <br> ', $result['description'], '... <br> <a href="',$result['url'],'"target="_blank">',$result['url'],'</a></p>';
}
}else {
foreach ($errors as $error){
echo $error,'</br>';
}
}
}
?>
</body>
</html>
andyy121
-9
Junior Poster
Recommended Answers
Jump to Post@andyy121
You really need to learn how to connected to the database.
I'm bit tired reading this code. If you keep posting the same the code most likely no one will help you. You have to pay attention what other member give you suggestion and advice. It seems you just …
Jump to Post@andyy121
im traying to learn ok if i know where is the problem i will learn from my mistake if all of you are tired i is not my problem,if you know where is the problem i I would ask to help me i wont to learn where is …
Jump to Post@andyy121
@LastMitch aahhahhahahahaha you are such a big fail the problem wasnt in SELECT ect ect
Good Luck, I don't know what else to say.THIS IS FOR YOUUUUUUUUUUUUUUUU
And that is how you treat people who try and help. Mate you are a sad person. Shooting people down …
Jump to Post@andyy121
Arguments with other members aside, did correcting the spelling mistake solve the issue?
P.S remember. People who post answers on here are usually IT proffesionals that would normally charge a small fortune for the type of consultancy provided in here. yet they do it here for free. This can …
All 13 Replies
andyy121
-9
Junior Poster
andyy121
-9
Junior Poster
andyy121
-9
Junior Poster

LastMitch
Squidge
commented:
well said :)
+4
andyy121
-9
Junior Poster

LastMitch
theHop
18
Newbie Poster
andyy121
-9
Junior Poster
theHop
18
Newbie Poster
andyy121
-9
Junior Poster
happygeek
commented:
try growing up and accepting help from others without acting like a three year old whose toys have been taken away
-2
Squidge
101
Newbie Poster
LastMitch
commented:
I agree
+3
theHop
18
Newbie Poster
LastMitch
commented:
Right on Target!
+3

LastMitch
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.