MDanz Posted August 12, 2009 Share Posted August 12, 2009 I changed some values of results in phpmyadmin and now the search engine doesn't work. It just displays no results found. The code is correct i'm sure, what could be wrong? <?php //get data $button = $_GET['submit']; $search = $_GET['search']; if (!$button) echo "You didn't submit a keyword"; else { if(!isset($search) || strlen($search)<=2) echo "<br><font color=white>search term too short</font>"; else { echo "<br><br><font color=white>you searched for <b>$search</b></font><hr size='1'>"; } mysql_connect("localhost", "Master", "password"); mysql_select_db("Login"); //explode our search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if($x==1) $construct .= "keywords LIKE '$search_each'"; else $construct .= "OR keywords LIKE '$search_each'"; } //echo out $construct $construct = "SELECT * FROM Upload WHERE $construct"; } $run = mysql_query($construct); $foundnum = mysql_num_rows($run); if ($foundnum==0) echo "<br><br><font color=white>No Stacks Found</font>"; else { echo "<font color=white>$foundnum Stacks Found!</font><p>"; if($_GET['RadioGroup1']== 1 ) $margin = 'style="margin-left:60px"'; else if($_GET['RadioGroup1']== 2 ) $margin = 'style="margin-left:120px"'; else if($_GET['RadioGroup1']== 3 ) $margin = 'style="margin-left:180px"'; else if($_GET['RadioGroup1']== 4 ) $margin = 'style="margin-left:240px"'; else if($_GET['RadioGroup1']== 5 ) $margin = 'style="margin-left:300px"'; else if($_GET['RadioGroup1']== 6 ) $margin = 'style="margin-left:360px"'; else if($_GET['RadioGroup1']== 7 ) $margin = 'style="margin-left:420px"'; else if($_GET['RadioGroup1']== 8 ) $margin = 'style="margin-left:480px"'; else $margin = 'style="margin-left:0px"'; echo '<table '.$margin.'>'; while ($runrows = mysql_fetch_assoc($run)) { //get data $name = $runrows['name']; $image = $runrows['image']; $hyperlink = $runrows['hyperlink']; $currency = $runrows['currency']; $info = $runrows['info']; $type = $runrows['type']; echo '<tr><td>'; switch ($type) { case 'I': echo '<img src="http://www.u-stack.com/Image.jpg">'; break; case 'M': echo '<img src="http://www.u-stack.com/Music.jpg">'; break; case 'F': echo '<img src="http://www.u-stack.com/File.jpg">'; break; case 'V': echo '<img src="http://www.u-stack.com/Video.jpg">'; break; case 'J': echo '<img src="http://www.u-stack.com/Job.jpg">'; break; case 'D': echo '<img src="http://www.u-stack.com/Discussion.jpg">'; break; case 'P': echo '<img src="http://www.u-stack.com/Product.jpg">'; break; } echo '</td></tr>'; } echo '</table>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/169863-search-engine-suddenly-not-working/ Share on other sites More sharing options...
MDanz Posted August 12, 2009 Author Share Posted August 12, 2009 i have rows in my database howcome it isn't finding any? Quote Link to comment https://forums.phpfreaks.com/topic/169863-search-engine-suddenly-not-working/#findComment-896130 Share on other sites More sharing options...
Philip Posted August 12, 2009 Share Posted August 12, 2009 Dude, chill out. It has barely been 30 minutes and you're already bumping your thread. Have you tried echo'ing your query and seeing if anything is amiss there? Quote Link to comment https://forums.phpfreaks.com/topic/169863-search-engine-suddenly-not-working/#findComment-896134 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.