bagnallc Posted July 3, 2006 Share Posted July 3, 2006 hi when i run the following query on mysql database it is very fast (immediate)SELECT id, name from names WHERE MATCH(name) AGAINST ('whatever*' IN BOOLEAN MODE)but when i use it in a page with php it is hanging (although does eventually return as expected)is there a better way of writing the code?here is code<?php require("connectmysql.php");$search=$_GET["name"];$data= "%".$search."%";if(isset($search)) {$qry= mysql_query("SELECT id, name from names WHERE MATCH(name) AGAINST ('$search*' IN BOOLEAN MODE)"); }if (isset($qry)) { echo "Here are the results:<br><br>"; echo "<form>";echo "<table align=center border=1><tr><th align=center bgcolor=#00FFFF></th></tr>"; while($checkbox=mysql_fetch_array($qry)) { echo "<tr><td><input type='checkbox' name='name[]' value=$checkbox[id]>" . " " . $checkbox[name] . "</td></tr>" ; }echo "</table><input type='submit' value='GO!'></form>"; }?> Link to comment https://forums.phpfreaks.com/topic/13598-mysql-search/ Share on other sites More sharing options...
Barand Posted July 3, 2006 Share Posted July 3, 2006 You could try a simple query instead of a fulltext search[code]<?phprequire("connectmysql.php");if(isset($_GET['name'])) { $search=$_GET["name"]; $qry= mysql_query("SELECT id, name from names WHERE name LIKE '%$search%' "); }?>[/code] Link to comment https://forums.phpfreaks.com/topic/13598-mysql-search/#findComment-52704 Share on other sites More sharing options...
bagnallc Posted July 3, 2006 Author Share Posted July 3, 2006 thanks for reply. i did actually try that but it still hung.i have just changed my form to a dropdown box and its an immediate response now! i dont really understand why but once it works im happy!thanks again for your advice though Link to comment https://forums.phpfreaks.com/topic/13598-mysql-search/#findComment-52705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.