About us Privacy Disclaimer Contact us
FAQ Help Advertising Feedback
Home Sitemap Search Donate us

  Home > Computer & I'net > WHERE...

   Browse by title articles:
   What is hot:

Include

INSERT

SELECT

WHERE

FRAMES & RULES
Directory on/off
Can You Restore Your Data From Your Backup?
Module mod_rewrite Tutorial (Part 2)
Prev articles1 2 



WHERE


Computer & I'net articlesWHERE

by David Stanley    



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.




-----------------
Article by David Stanley. Visit his site http://www.htmlite.com. Reprinted with permission.




Articles

Auto & Trucks

Business

Computer & I'net

  ·General

  ·Apache

  ·CSS

  ·Database

  ·Hardware

  ·HTML

  ·Javascript&DHTML

  ·Linux

MySQL

  ·Operating System

  ·Perl / CGI

  ·PHP

  ·Programming

  ·Publishing

  ·Search Engines

  ·Software Problems

  ·SSI

  ·Tips & Tricks

  ·Utilities

  ·Web Design

Family

Food & Drink

Gardening

Health

Other

Pets

Psychology

Spiritual

Travel

Women

 Calculators

Group Work




  Disclaimer | Privacy | Terms of useCopyright © 2004 Nice2know.com