Selection error

echo $result;– displays the resource id. Why?


Answer 1, authority 100%

First, here    here there is also a selection output from the database
Read the function doc carefully and you will find that mysql_queryreturns a value of type resourse. In order to convert this data into an array, for example, you must use one of these mysql_fetch, mysql_fetch_row, mysql_fetch_assoc. You can always find out about the difference at php.net

In your specific case:

$dbResult = mysql_query('SELECT `school` . `street` FROM `datacenter`, `school` WHERE `datacenter` . `id_school` = `school` . `id_school` AND `datacenter` . `name` = ""');
$resultArray = array();
while( $row = mysql_fetch_assoc( $dbResult ) ) {
    $resultArray[] = $row;
}
//          
//      $resultArray
//     ,      echo
print_r($resultArray);    //      

PS: I suspect that it would be nice for you to start with the book “series” “php for dummies”, good for you – there are plenty of such books on the net …


Answer 2

Because it’s a resource! The data must be obtained separately.

$res = mysql_query($sql, $conn);
while($row=mysql_fetch_array($res)){
 ...
}