Question

I am using a PHP function to pull some information into a list for me - and it pulls all of it, but the sort is not working and I have messed with the LIMIT and it doesn't work as well...

if(strtolower($term) == 'feature') {
    $query = "select * FROM $table WHERE (tags LIKE 'feature') ORDER BY rid DESC     LIMIT 1";
}  
Was it helpful?

Solution

I think you are wanting to use some % operators eg these will match anything in your like statement.

Match any tag that has the word feature in it, other letters might be on left and right of word.

$query = "select * FROM $table WHERE (tags LIKE '%feature%') ORDER BY rid DESC     LIMIT 1";

Match any tag that has that start with feature and may have other words or letters after

$query = "select * FROM $table WHERE (tags LIKE 'feature%') ORDER BY rid DESC     LIMIT 1";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top