Jump to content

mysql search


bagnallc

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.