Reputation: 61
How can I count multiple MySQL table rows using text? currently I am using text(names) instead of numbers as values, I know how to count numbers but I have text with spaces where space is not allowed in MySQL.
my code looks like this.
$q = 'SELECT count(TS) as count FROM TABLE_TEST WHERE
TS='.$db->qstr(Test Data).' GROUP BY id';
as we all know Space between Test Data is not allowed, how can I search using text?
Thanks a lot.
Upvotes: 0
Views: 73
Reputation: 799
You need to surround strings with either single quotes or double quotes. Single quotes are better in PHP as they are not parsed for variables.
Upvotes: 1