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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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