I am attempting to hack a tutorial from the Zend site. I have found the
tutorial/project to be excellent, but I don't completely understand what's
being done in the following Query statement.

//query database, assemble data for selectors 
    $Query = "SELECT s.ID, s.Name, a.Code " . 
        "FROM areacode a, state s " . 
        "WHERE a.State = s.ID " . 
        "ORDER BY s.Name, a.Code"; 
    if(!($DatabaseResult = mysql_query($Query, $DatabaseLink))) 
    { 
        print("The query failed!<br>\n"); 
        exit(); 
    } 

Please explain what's going on in this SELECT statement. I'm assuming that
the "s" in "s.ID", the "s" in "s.Name" and the "a" in "a.Code" are
variables referring to the table name. "ID", "Name" and "Code" are field
names in two different tables. But, I can't find a place where these
variables are initiated in the preceding code.

I also don't understand what's going on in the FROM statement. "Areacode"
and "state" are table names. That I understand. What's with the "a" and "s"
following the table names? Is this where the variables are initiated?

Thanx for all your help. This newsgroup has been invaluable to my learning
process.
-- 
Robb Kerr
Digital IGUANA
Helping Digital Artists Achieve their Dreams
http://www.digitaliguana.com
http://www.cancerreallysucks.org

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to