I have the following query with a subquery, this is the php code:
$staticsQuery = "SELECT * FROM statics WHERE mmsi = (SELECT mmsi FROM positions,active WHERE active.mmsi = positions.position_ID)";
$staticsResult = mysql_query($staticsQuery);
while($rows = mysql_fetch_array($staticsResult)){
echo $rows['time'];
echo $rows['mmsi'];
echo $rows['name'];
echo $rows['imo'];
}
The subquery part is normally working, which prints out results. I am not sure if this outer query part is correct:
SELECT * FROM statics WHERE mmsi =
This is the error I am getting,
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\retrieve.php on line 44
The error obviously comes from mysql_fetch_array because the query does not return a result. Please don't mark this question as a duplicate, because there can be a lot of different type issues with this error message.
Any help is welcome!