sql - Building a search script in PHP -
i'm trying build search script in php-sql facebook or stackoverflow uses. example, user may put in multiple entries; separated semi-colon , autocomplete on each term. also: values stored in sql; type of data should use or how should insert terms in sql table??
<script type="text/javascript"> $().ready(function() { $("#job_type").autocomplete("get_job_list.php", { width: 224, matchcontains: true, selectfirst: false }); }); </script>
php code::
<?php require_once "connection.php"; $q = strtolower($_get["q"]); if (!$q) return; $sql = "select distinct itemid itemid eportal itemid '%$q%'"; $rsd = mysql_query($sql); while($rs = mysql_fetch_array($rsd)) { $cname = $rs['itemid']; echo "$cname\n"; } ?>
add chosen tags separated table structure query_id tag_id
(you need table tags
structure tag_id tag_name
. way query way easier , faster. moreover, able popular tags easily. sql meant storing data that. putting comma separated values against basics of sql.
Comments
Post a Comment