Could it be that you reuse the variable $query or $result further down leading to output the result of the first $query or to execute the same query again?
Thariama
2010-07-13 10:14:12
Could it be that you reuse the variable $query or $result further down leading to output the result of the first $query or to execute the same query again?
I'm not sure if this is the cause but...
first SQL:
$query = "SELECT name, pub, hospital, trade FROM settlements WHERE settlementID = 1";
Second:
$query = "SELECT name, shop, hospital, trade FROM settlements WHERE settlementID = 2";
in first one there's pub, in second one - shop. But you don't use shop value in PHP in second case, only pub (which is not in this SQL fields.
You may have SQL error here (no field in database) or PHP error (checking non-existent field in result array).