Note that there are some explanatory texts on larger screens.

plurals
  1. POBasic search engine not working
    primarykey
    data
    text
    <p>Hello i managed to make a simple search engine its basic so i started working on that.. But i get Access Forbidden and dont know why can someone help me? with a form i give the $find the word i search and it should search for it.. thx for your time!`</p> <pre><code> &lt;?php if ($searching =="yes") { echo "Results"; if ($find == "") { echo "You forgot to enter a search term"; exit; } mysql_connect("localhost","Anton","zouzou13") or die(mysql_error()); mysql_select_db("Ptyxiakh") or die(mysql_error()); $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); $data =mysql_query("SELECT * FROM documents WHERE keywords LIKE'%$find%'"); while($result = mysql_fetch_array( $data )) { echo $result['document_name']; echo " "; echo $result['first_paragraph']; echo "&lt;br&gt;"; } $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; } echo "&lt;b&gt;Searched For:&lt;/b&gt; " .$find; } ?&gt; ok i made it simpler to see if it works like this: &lt;?php error_reporting(E_ALL); mysql_connect("localhost","Anton","zouzou13") or die(mysql_error()); mysql_select_db("Ptyxiakh") or die(mysql_error()); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM documents WHERE keywords LIKE 'helmets'"); while($result = mysql_fetch_array( $data )) { echo $result['document_name']; echo " "; echo $result['first_paragraph']; echo "&lt;br&gt;"; } $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; } ?&gt; But i get the "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; so i cant connect to database?its just wont work :( With PDO it should be like this??: &lt;?php //This is only displayed if they have submitted the form if ($searching =="yes") { echo "&lt;h2&gt;Results&lt;/h2&gt;&lt;p&gt;"; //If they did not enter a search term we give them an error if ($find == "") { echo "&lt;p&gt;You forgot to enter a search term"; exit; } $pdo = new PDO('mysql:host=localhost;dbname=ptyxiakh', 'Anton', 'zouzou13'); // Otherwise we connect to our Database //mysql_connect("localhost","Anton","zouzou13") or die(mysql_error()); //mysql_select_db("Ptyxiakh") or die(mysql_error()); // We preform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified //$data = mysql_query("SELECT * FROM documents WHERE keywords LIKE'%$find%'"); $data= $pdo-&gt;query("SELECT * FROM documents WHERE keywords LIKE'%$find%'"); //And we display the results while($row = $statement-&gt;fetch(PDO::FETCH_ASSOC)) { echo htmlentities($row['document_name']); echo " "; echo htmlentities($row['first_paragraph']); echo "&lt;br&gt;"; } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Sorry, but we can not find an entry to match your query&lt;br&gt;&lt;br&gt;"; } //And we remind them what they searched for echo "&lt;b&gt;Searched For:&lt;/b&gt; " .$find; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload