Wednesday 15 May 2013

php - Limit fetched data from db into a list in HTML -


I am working on an automatic restart area and it already works. Now what I am trying to do is to limit the output of the data in the list below the search field. Can someone help me how to do this? I have already tried some methods, but ending with errors, what I am trying to do is to limit the amount of results that come out of the database. I tried to do it in php (I think this is according to better performance, right?). This code works well in advance:

  & lt; Php require_once 'connect.php'; If (isset ($ _ POST [ 'search_term']) == true and amp; amp; empty ($ _POST [ 'search_term']) == false) {$ search_term = mysql_real_escape_string ($ _POST [ 'search_term']); $ Query = mysql_query ( "select" Words like 'Demetistist' the word '' '$ search_term%' "); while (($ row = mysql_fetch_assoc ($ query)) == false) {echo '& lt; li & Gt; ', $ line [' word '],' & lt; / li & gt; ';}}? & Gt;   

Since I'm not an expert,

Easiest way to update your SQL query There will be a boundary block, so if you want only the first 10 results, then it will be Like:

  Select the word 'datlist' from the word 'word' such as '$ search_term%' LIMIT 10;   

Can do this in php without modifying, but I found this to be the easiest if you want to drag it from the database that you want.

By the way, you're using the old. This extension is running PHP 5.5.0 , And will be removed in the future. Instead, or the extension should be used.

No comments:

Post a Comment