$sql = "SELECT received FROM $dbsql ORDER BY id LIMIT 1" ;
$results = mysql_query ( $sql );
while ( $myrow = mysql_fetch_array ($results )) {
$date = $myrow ["received" ];
echo $date ;
}
This is the error:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource.
This error referred to the line -> while ( $myrow = mysql_fetch_array ($results )) { <-
The error you are getting is most likely because you have not established a connection to your database. Assuming your variable $dbsql correctly contains a valid mysql table and the field received exists in that table, your query statement is syntactically correct and you do not need to place single quotes around your field names. Questionable advice...
Instead of using a while loop, try using the function mysql_num_rows to capture the number of rows selected by your query, assigning that to a variable, say $nr (number of rows), and using a for loop to iterate through your results:
$nr = mysql_num_rows($results);
echo $nr;
for ($a=0; $a<$nr; $a++) {
get a record
... other code here
}
echo $nr before this loop executes troubleshoots and determines whether or not any results are being returned by your mysql_query function.
Also, instead of monkeying around with the raw php functions, write your own functions that you can call; they can include the php functions, adding in your own debugging echo statements, capturing invalid return values from the php functions.