Cita:
Iniciado por sentnel
Gracias Oasis8 !
Sigo con el problema, he tratado algunas otras maneras, el problema esta en como manejo la parte de "mysql_fetch_row"
Aqui esta mi codigo:
Código PHP:
<?php
$link = mysql_connect('localhost', 'midatabase', 'miclave');
if (!$link) {
die('No pudo conectarse: ' . mysql_error());
}
?>
<?php
$query = "SELECT
SUM(pte_circuns_her_arm_fuego) FROM jos_polnac_partediario_gen
WHERE departamento_pn='1' AND fecha_hora_partediario BETWEEN DATE ('2010-10-17 17:33:00') AND ('2010-10-20 00:55:00')";
$result = mysql_query($query);
while($row = mysql_fetch_row($result)){
echo $row[0];
}
?>
El error que me tira es:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in F:\xampp\htdocs\palacio\stats\stat1.php on line 16
Por favor, indiquenme la syntaxis correcta para mostrar el resultado, que en este caso es "32", o sea, me interesa que "echo" resulte "32", que es el total de la suma que indica mi query.
Gracias!
Nota: Les confirmo que el query esta correcto ya que arroja el resultado correcto cuando lo corro en el manejador MySQL SQLYog.
uhm, this issue is because something is wrong in the query or bd connection
try to put echo to the $query, and run this query that show in yog,
if this work, then try without while, only set the var $row and show the result (row[0])
try and comment
greetings