shadowline
WHERE << CONDITIONALS >> LIKE and NOT LIKE
CONDITIONALS are operators which allow you to get more specific (or general) in your query.

=equals
<less than
>greater than
<=less than or equal to
>=greater than or equal to
!=not equal to
IS NOT NULLhas any value
IS NULLhas no value at all
BETWEENwithin a specified range
NOT BETWEENoutide of a specified range
ORone of two equations are true
||same as OR
ANDboth equations are true
&&same as AND
NOTboth equations are false
!same as NOT


$sql = mysql_query("SELECT * FROM table_name WHERE some equation && another equation");

while ($row = mysql_fetch_row($sql)) {
echo "$row[0] $row[1] $row[2] <br />";
}

The query will only pick out the rows that provide a TRUE result according to the WHERE equation. In this case, there would be TWO parts that must be true to return a result. Example...

$sql = mysql_query("SELECT * FROM address_book WHERE first_name='David' && last_name='Stanley'");

while ($row = mysql_fetch_row($sql)) {
echo "$row[0] $row[1] $row[2] <br />";
}

The query would search the address_book table and compare all of the data in the first_name column AND the last_name column for the specified values. The WHILE loop then prints out the results found if both equations are found TRUE.
WHERE << CONDITIONALS >> LIKE and NOT LIKE
shadow

Advertise in the banner along the top, Click here!

Valid XHTML 1.0 Transitional Valid CSS! Text Link Ads
shadow
shadow