Hello,

I just learn PHP for a month now. It's hard for me
since I have no background in programming (I do HTML
but this is totally different).
Last few days I try to make a simple script so
visitors can search my site. I use a MySQL database
here and there are some tables to handle my other PHP
works. The "search" table contains: words_id, words,
path_id, file_id, and info fields.

This is my snippet: 
<?php//search.php
// Connect to database
include "db.php";
// Looking for the right word
$query = mysql_query ("SELECT search.words_id,
search.words, search.path_id, search.file_id,
search.info, tips.tips, path.path_id, path.path,
filename.file_id FROM search, tips, path, filename 
                        WHERE words LIKE '%$search%', search.path_id =
path.path_id AND search.file_id = filename.file_id 
                        ORDER BY words_id");
if (empty($query)){
                echo "<P>Sorry, no matching ...</P>";
        }
else {// Display search
        while ($hasil = mysql_fetch_array($query)){
                echo "<P><A
href=\"$hasil[path]/tip.php?file_id=$hasil[file_id]&tips=$hasil[tips]\">$hasil[tips]</A>";
                echo "$hasil[info]</P>\n";
        }
}
?>

And here's my search form:
  <FORM method="GET" action="search.php">
     <INPUT type="text" name="search" size="15">
     <INPUT type="submit">
  </FORM>

But I always get the "Sorry, no matching ..." output
even though my SQL table has the word in its field.
Would someone help me with this. Any suggestion, hints
or tips will help me so much.

Thank you in advance,

=====
Best regards, 

Dewara Sianipar
My Personal Pages.

"Life is like a beautiful melody, only the lyrics are messed up." 
-Anon.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to