CONDITIONALS are operators which allow you to get more specific (or general) in your query.
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...
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.
| = | equals |
| < | less than |
| > | greater than |
| <= | less than or equal to |
| >= | greater than or equal to |
| != | not equal to |
| IS NOT NULL | has any value |
| IS NULL | has no value at all |
| BETWEEN | within a specified range |
| NOT BETWEEN | outide of a specified range |
| OR | one of two equations are true |
| || | same as OR |
| AND | both equations are true |
| && | same as AND |
| NOT | both 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 />";
}
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 />";
}
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.


