The WHERE property of a query makes it possible to single out specific rows.
The query will only pick out the rows that provide a TRUE result according to the WHERE equation. Example...
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.
$sql = mysql_query("SELECT * FROM table_name WHERE some 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. 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 />";
}
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.

