shadowline
SELECT << WHERE >> CONDITIONALS
The WHERE property of a query makes it possible to single out specific rows.

$sql = mysql_query("SELECT * FROM table_name WHERE some 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. Example...

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

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 for the specified value. The WHILE loop then prints out the results found.

The equation used for the WHERE property can be a large number of possibilities. You can use variables, additional equations with &&, alternative equations with ||, and so on.
SELECT << WHERE >> CONDITIONALS
shadow

Advertise in the banner along the top, Click here!

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