It is a little hard to advise on this without knowing the table schema, but
it is generally best to make the database do as much of the work as possible
rather than use logic in your script because databases are specifically
optimized for what they do.  If I were trying to do what you are talking
about, I would try to use a join in my query.  For help with join syntax,
see
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#JOI
N.

In your case, if the aptID field is shared, and there is a one-to-one
relationship between the tables (there is a row in each table for each
apartment), the query might look something like this:
$sql = "SELECT * FROM $table1, $table2 WHERE table1.aptID=table2.atpID AND
table1.apt_city = \"$apt_city\"  ";

Each row of the result set will include the data from both tables.




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to