Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

PHP Search

Name: Anonymous 2007-07-13 3:44 ID:Ak4R4Bn8

In before noob flame, thank you.

I'm like trying to create a PHP search script for my website. So far I have two files: index.php and search.php

form of index.php looks like this:

<div id="search">
   <form method="post" action="search.php">
      <input type="text" name="search">
      <input type="submit" value="Search!">
   </form>
</div>

search.php file looks like this:

<?php
   $search_result = 0;
   $query = " SELECT * FROM items WHERE itemid LIKE '%$search%' ";
   $search_result = mysql_query($query) or die(mysql_error());

   if ($search_result > 0) {
      search_result($search_result);
   }
   else {
      echo " No results to display! ";
   }
?>

What the fuck I am doing wrong?

Name: Anonymous 2007-07-13 4:00 ID:vHDySY+s

hmmm
try to add $search = $_POST['search'];
in the beginning of the search php and change
if ($search_result > 0) to if($search_result != "")

and you havent defined function search_result()
...
so basically its all fucked up!

Name: Anonymous 2007-07-13 4:17 ID:Heaven

>>1
sql injection lol

Name: Anonymous 2007-07-13 4:37 ID:Ak4R4Bn8

>>2
This is how search.php looks now:

<?php
   $search = $_POST['search'];
   $query = " SELECT * FROM items WHERE itemid LIKE '%$search%' ";
   $search_result = mysql_query($query) or die(mysql_error());

   if ($search_result != "") {
      search_result($search_result);
      $search_result == "";
   }
   else {
      echo " No results to display! ";
   }
?>

I have search_result function defined elsewhere.

Except the paging it looks like this:

function search_result($search_result) {
   $var = " SELECT * FROM items WHERE itemid = '$search_result' ";
   $var_query = mysql_query($var) or die(mysql_error());
   echo $var;
}

Still got an blank page ;(

Name: Anonymous 2007-07-13 4:48 ID:MD+7xNDG

<?php
echo '<html><body><h1>WELCOM TO MY WEB SIGHT</h1></body></html>';
?>

Name: Anonymous 2007-07-13 5:09 ID:7nFHvOnE

SQL Injection FTW!

Name: Anonymous 2007-07-13 16:14 ID:Heaven

lol php

Name: Anonymous 2007-07-14 8:16 ID:lpvu4hzK

Google uses a 2 line PHP script for their search engine, too.

Name: Anonymous 2007-07-14 10:59 ID:Heaven

>>8
<?php require('real_search_engine.py');
/* lol second line */ ?>

Name: Anonymous 2009-01-14 14:26

What?

Name: Anonymous 2011-01-31 21:31

<-- check em dubz

Name: Anonymous 2011-02-03 8:44

Don't change these.
Name: Email:
Entire Thread Thread List