Jump to content

ava5193

New Members
  • Posts

    2
  • Joined

  • Last visited

ava5193's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thnx for reply Ch0cu3r You are right When i try it... it added new error: and i cant understand it? pls help what does this mean? // I search for aa Notice: Query has failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Or search like ('%aa%')' at line 1 in E:\pagong\ProgramFiles\wamp\www\mandaya\pages\modifier\seach_topics.php on line 108
  2. GOOD DAY phpfreaks.com Can Anyone Help about my code. My search engine can search and display if there is no user logged-in, but it goes wrong when it have user logged-in ? //The Error Shown Every time I have user Loginerror.txt Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\pagong\ProgramFiles\wamp\www\mandaya\pages\modifier\search.php on line 103 //The Search Form search-form.txt <form action="search.php" method="get" id="form1" name="form1" > <input name="keysearch" type="text" value="<?php echo $_GET['keysearch']; ?>" size="30" height="30px" placeholder="Search Mandaya Topics" id="s_box" /> <input type="submit" value="SEARCH" class="s_in"/> </form> // my php search code searchcode.txt <?php $keysearch = $_GET['keysearch']; $keysearch = filter_var($_GET['keysearch'], FILTER_SANITIZE_STRING); $keysearch = htmlspecialchars($_GET['keysearch']); $terms = explode(" ", $keysearch); $query = "Select * from images Where "; foreach ($terms as $each){ $i++; if ($i==1) $query .= "search like '%$each%' "; else $query .= "Or search like '%$each%' "; } //connect mysql_connect("localhost", "root"); mysql_select_db("mandaya"); //Done if Search is filled if(!empty($keysearch)){ $query = mysql_query($query); //Execute the query $query $numrows = mysql_num_rows($query); //Count the result of query //Get the DB fields from query if ($numrows > 0 ){ //Set each other while ($row = mysql_fetch_assoc($query)){ $id_topic = $row ['id_img']; $title = $row ['title']; $description = $row ['description']; $a = $row ['desc_a']; $b = $row ['desc_b']; $c = $row ['desc_c']; $d = $row ['desc_d']; $e = $row ['desc_e']; $link1 = $row ['link1']; $link2 = $row ['link2']; $key = $row ['keywords']; echo "<ul class='image_list'> <li><form method='POST' action='index.php'> <input type='hidden' name='topic' value='$id_topic'/> <input type='hidden' name='title' value='$title'/> <input type='image' name='img' value='$link1' src='$link1' size='100px' height='100px' title='$title'/> <input type='hidden' name='desc' value='$description'/> <input type='hidden' name='desc_a' value='$a'/> <input type='hidden' name='desc_b' value='$b'/> <input type='hidden' name='desc_c' value='$c'/> <input type='hidden' name='desc_d' value='$d'/> <input type='hidden' name='desc_e' value='$e'/> <input type='hidden' name='key' value='$key'/> <input type='hidden' name='image1' value='$link1'/> <input type='hidden' name='image' value='$link2'/> </form></li> </ul>"; } } else echo " <center>No results found for \"<b>$keysearch</b>\""; } //disconnect mysql_close(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.