Note that there are some explanatory texts on larger screens.

plurals
  1. POautosuggest showing blank li's
    primarykey
    data
    text
    <p>I am using <a href="http://papermashup.com/jquery-php-ajax-autosuggest/" rel="nofollow">Paper Mashups Autosuggest.</a></p> <p>I just finished doing a mysql union to bring three tables into one so I could autosuggest names of companies, names of categories and names of subcategories. Unfortunately, while that worked, it added extra li's ( I think that's what they are, here's the <a href="http://i.imgur.com/wlhoJ.png" rel="nofollow">picture.</a>) </p> <p>How do I get rid of those extra li's?</p> <p>Here's my code:</p> <pre><code>&lt;?php $db = new mysqli('localhost', 'root' ,'*********', '****************'); if(!$db) { echo 'Could not connect to the database.'; } else { if(isset($_POST['queryString'])) { $queryString = $db-&gt;real_escape_string($_POST['queryString']); if(strlen($queryString) &gt;0) { $query = $db-&gt;query("SELECT name FROM company WHERE name LIKE '$queryString%' UNION SELECT cat FROM cat WHERE cat LIKE '$queryString%' UNION SELECT subcat FROM subcat WHERE subcat LIKE '$queryString%' LIMIT 10"); if($query) { echo '&lt;ul&gt;'; while ($result = $query -&gt;fetch_object()) { echo '&lt;li onClick="fill(\''.addslashes($result-&gt;name).'\');"&gt;'.$result-&gt;name.'&lt;/li&gt;'; echo '&lt;li onClick="fill(\''.addslashes($result-&gt;cat).'\');"&gt;'.$result-&gt;cat.'&lt;/li&gt;'; echo '&lt;li onClick="fill(\''.addslashes($result-&gt;subcat).'\');"&gt;'.$result-&gt;cat.'&lt;/li&gt;'; } echo '&lt;/ul&gt;'; } else { echo 'OOPS we had a problem :('; } } else { // do nothing } } else { echo 'There should be no direct access to this script!'; } } ?&gt; </code></pre> <p>Thanks for all help!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload