Reputation: 2704
How can I grab data from a database using an mySQL query which will get all rows that start with a certain string, for example;
$string = 'WS';
mysql_query("SELECT * FROM `table` WHERE `name` STARTS WITH '$string'");
something like the above
Upvotes: 0
Views: 110
Reputation: 5094
SELECT * FROM `table` WHERE `name` LIKE 'WS%'
it will fetch only those values those have ws at the start...and not all values..try it once
Upvotes: 0