Page 1 of 1

Trying to figure out what something is called

Posted: Thu Oct 13, 2005 10:26 am
by Glass Casket
I'm simply trying to figure out what it's called when you do $letter=d, &letter=a, and so on. And it only retrieves the rows from the database that start with that letter. I'm trying to find out how to do it, but can't find a tutorial.

Thanks!

Posted: Thu Oct 13, 2005 10:32 am
by Jenk
wuh?

Posted: Thu Oct 13, 2005 11:17 am
by Chris Corbyn

Code: Select all

$letter = 'd';

$query = "SELECT field_name FROM table_name WHERE some_field LIKE '{$letter}%'";
Not sure what you mean what it's called? Searching/sorting? :)

Posted: Thu Oct 13, 2005 11:39 am
by Glass Casket
Thanks, after reading that and palying with it I figured some of it out. But I can't seem to figure out how to query all the rows begining with a letter at the same time. Instead of having a query for each letter.

Posted: Thu Oct 13, 2005 7:48 pm
by feyd
use the REGEXP command..

Posted: Fri Oct 14, 2005 8:42 pm
by Glass Casket
feyd wrote:use the REGEXP command..
Thank you, that worked!