"'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC'; else $sql1='SELECT * FROM tagente_datos WHERE timestamp > "'.$from_date.'" AND timestamp < "'.$to_date.'" AND id_agente_modulo ='.$id_agentmodule.' ORDER BY timestamp DESC'; $result1=mysql_query($sql1); // Render data while ($row=mysql_fetch_array($result1)){ echo $agentmodule_name; echo ","; echo $row["datos"]; echo ","; echo $row["timestamp"]; echo chr(13); } } ?>