this is the index page
<?php
if (isset ($_POST['keywords'])){
$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);
echo '<p>Your search for <strong>',$keywords,'</strong>returned <strong>',$results_num,'</strong>results</p>';
}else {
foreach ($errors as $error){
echo $error,'</br>';
}
}
}
?>
andyy121
-9
Junior Poster
Recommended Answers
Jump to Post@andyy121
The problem is that it doesnt display what is in the database but it show no results found,help me plzz im lost now i have seen a lot of tutorial but i haven't fix this
1) Is your DB connected?
2) Can you Select:
Jump to PostLine 16 and 21 still have single quotes around keywords and description. Change them to backticks.
Jump to Post@andyy121
i wont to know where is my mistake
I think everyone has explain the mistakes to you. But you still being very rude.
Jump to PostRemoved the comma after
url
(beforeFROM
) and afterarticles
(beforeWHERE
).I strongly suggest you read up on how to write correct MySQL queries, because you are making some very basic errors.
All 16 Replies
andyy121
-9
Junior Poster
andyy121
-9
Junior Poster
andyy121
-9
Junior Poster
LastMitch
andyy121
commented:
thank you for responding to my problem
+0
andyy121
-9
Junior Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
andyy121
-9
Junior Poster
andyy121
-9
Junior Poster
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
andyy121
-9
Junior Poster
LastMitch
andyy121
-9
Junior Poster
happygeek
commented:
nobody will help you with that attitude
-2
LastMitch
pritaeas
2,194
¯\_(ツ)_/¯
Moderator
Featured Poster
andyy121
-9
Junior Poster
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.