Re: function MAX with WHERE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Jesús Alain Rodríguez Santos" <wmaster@xxxxxxxxxxxxxxxx> wrote in message
news:2103.192.168.6.61.1122271572.squirrel@xxxxxxxxxxxxxxxxxxxxxxxxxx
> I have someting like this:
>
> $test = mysql_query("SELECT MAX(dato) AS datos FROM tabla WHERE campo_mes
> = '$mes'");
> $test_m = mysql_fetch_array($test);
> $test_mes = $test_m['datos'];
>
> print $test_mes
>
> where $mes is a value
> I need to know if something its wrong, because I don't recive any error,
> but I see nothing

Try this, it will tell you if something is wrong

echo  mysql_error();

If nothing is wrong, then perhaps your query returns no rows? Test this by
removing the where clause (assuming there is some data in tabla).

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux