I'm trying to build a search script in PHP-SQL something like Facebook or Stackoverflow uses. For example, the user may put in multiple entries; separated by a semi-colon and with Autocomplete on each term. Also: the values are to be stored in SQL; so what type of data should I use or how I should insert those 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 as itemid from eportal where itemid LIKE '%$q%'";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$cname = $rs['itemid']; echo "$cname
";
}
?>