Jump to content
JoaoVM

Erro PHP Resource id #5

Recommended Posts

JoaoVM

Boa tarde, tenho uma duvida quanto a um código php que estou a desenvolver, a questão é que quero fazer uma média, a consulta no MySql funciona mas na meu servidor dá o erro Resource id#5,

$resultado_pph = mysql_query("select turno,avg(pph) from producao where turno=1 and data=current_date group by turno");
$med_pph = ($resultado_pph) or die(mysql_error());
echo "<center><font face=\"arial\" size=\"3\">Média do PPH: $med_pph</font></center>";

o resultado é o seguinte:

http://prntscr.com/w122k

fiz umas pesquisas e dizem que tenho que usar mysql_fetch_assoc($resultado_pph), mas continua a não estar correcto e obtenho o seguinte:

http://prntscr.com/w11zo

Alguém me sabe ajudar?

Edited by brunoais
geshi

Share this post


Link to post
Share on other sites
HappyHippyHippo

 select turno,
        avg(pph) AS MEDIA
   from producao
  where turno=1
    and data=current_date
group by turno

$record = mysql_fetch_assoc($resultado_pph);
echo "<center><font face='arial' size='3'>Média do PPH: {$record['MEDIA']}</font></center>";

Edited by HappyHippyHippo

IRC : sim, é algo que ainda existe >> #p@p

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.