Forum Moderators: open
It now displays a maximum of $max_results on one page as per the script and ascending order of title.
Now i want to display only those articles whose title start from 'a' or 'A'
Also to make the query dependent on the $_GET . means if i pass example.com/pages.php?alphabet=d then all the articles having title starting with d should be displayed.
How to write the query?
[php]
$ArticleContain = $_GET['alphabet'];
$sql = mysql_query("SELECT * FROM articles WHERE (`trusted` = 0 AND `catid` = $catid) And title LIKE '".$ArticleContain."%' ORDER BY `title` ASC LIMIT $from, $max_results");
[/php]
The LIKE and NOT LIKE have two search helper symobls. The underscore _ character that looks for one character and the percentage % character that looks for zero or more characters.
$q = strtolower [php.net](strip_tags($_GET['alphabet']));
SELECT * FROM table WHERE SUBSTRING [dev.mysql.com](LOWER [dev.mysql.com](title),1,1)=='{$q}'...
dc