D devanium Established Member ★ 20 ★ Impact 0 Dec 3, 2005 517 views 3 replies #1 If I have a database full of names, for example, and I want to query how many "John" names are in the database, how can I do this? Any help would be greatly appreciated Thanks!
If I have a database full of names, for example, and I want to query how many "John" names are in the database, how can I do this? Any help would be greatly appreciated Thanks!
G gamex Established Member ★ 20 ★ Impact 7 Dec 3, 2005 #2 You can do something like this: PHP: $result = mysql_query("SELECT * FROM Table WHERE FirstName = 'John'") $num_rows = mysql_num_rows($result);
You can do something like this: PHP: $result = mysql_query("SELECT * FROM Table WHERE FirstName = 'John'") $num_rows = mysql_num_rows($result);
P phpmyborder Established Member ★ 20 ★ Impact 1 Dec 4, 2005 #4 or SELECT * FROM Table WHERE Firstname LIKE '%John%' then you'll get all names containing John.. like 'Johnny', 'Big John' ... etc...
or SELECT * FROM Table WHERE Firstname LIKE '%John%' then you'll get all names containing John.. like 'Johnny', 'Big John' ... etc...