<html> <head> <title>Controle de Conexão</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table border="1"><tr> <td><b>ID</b></td> <td><b>Data</b></td> <td><b>Nome</b></td> <td><b>Cache</b></td> <td><b>Fora de Cache</b></td> <td><b>ID do Site</b></td> <td><b>Sumario de tempo</b></td> </tr> <?php function fetch_records($table_name, $fields){ include 'conexao.php'; // começando a partir de $do_dia = "28"; $do_mes = "05"; // até ... $ate_dia = "29"; $ate_mes = "05"; //include 'execulta_sql.php'; // Fazendo uma consulta SQL e retornando os resultados em uma tabela HTML id, date, userID, inCache, outCache, sitesID, summaryTime //$query = "SELECT 'traffic'.id, 'traffic'.date, 'traffic'.time, 'traffic'.bytes, 'traffic'.url, 'traffic'.authuser, 'hostnames'.id, 'hostnames'.hostnames //FROM traffic, hostnames WHERER traffic.id = hostnames.id"; //$query = "SELECT trafficSummaries.id,trafficSummaries.date, hostnames.hostname //FROM trafficSummaries,hostnames WHERE trafficSummaries.data LIKE '%2010-05-28%' AND trafficSummaries.id = hostnames.id"; /*$query = "SELECT trafficSummaries.* FROM trafficSumaries WHERE DATA_FORMAT(data, '%m-%d') BETWEEN DATA_FORMAT('2010-$do_mes-$do_dia','%m-%d') AND DATA_FORMAT('2010-$ate_mes-$ate_dia','%m-%d')";*/ $query = "SELECT * FROM trafficSummaries WHERE data BETWEEN '05-28' AND '05-29'"; $resultado = mysql_query($query,$conexao); if($resultado) { if(mysql_num_rows($resultado) == 0){ return "nao a dados no seu database"; } Else { while($arr = mysql_fetch_array($resultado, MYSQL_ASSOC)){ $table .= "\t\t<tr>\n"; foreach ($arr as $val_col) { $table .= "\t\t\t".'<td>'.$val_col.'</td>'."\n"; } $table .= "\t\t</tr>\n"; } $table .= "</table>"; return $table; } mysql_free_result($run); } //while ($linha = mysql_fetch_array($resultado)) return "erro ao criar tabela."; } { ?> <tr> <td><?php echo $linha['id']; ?></td> <td><?php echo $linha['date']; ?></td> <td><?php echo $linha['userID']; ?></td> <td><?php echo $linha['inCache']; ?></td> <td><?php echo $linha['outCache']; ?></td> <td><?php echo $linha['siteID']; ?></td> <td><?php echo $linha['summaryTime']; ?></td> </tr> <?php } //$table = "product_master"; //$cols = array("id","date","userID","inCache","outCache","sitesID","summaryTime","ase",); echo fetch_records($table, $cols); //mysql_closed($conexao) ?> </table> </table> </body> </html>
resolvi meu problema mas agora quando eu coloco o seguinte comando...
$query = "SELECT traffic.id, traffic.date, traffic.time, traffic.url, traffic.authuser, hostnames.hostname FROM traffic,hostnames WHERE traffic.date BETWEEN '2010-05-28' AND '2010-05-29'";
o sistema ultrapassa o tempo limite ....
e nao retorna nada....
eu queria fazer algo tipo isso...
$query = "SELECT traffic.id, traffic.date, traffic.time, traffic.url, traffic.authuser, hostnames.hostname FROM traffic,hostnames WHERE traffic.date BETWEEN '2010-05-28' AND '2010-05-29' WHERE traffic.ip = hostnames.ip";