-2
The second selection of Store Procedure does not run... I did not find the bug...
<? require("viskoo_conexao/conectar.php");?>
<?php
$consulta="CALL SPMenuConsulta";
$resultado = mysql_query($consulta)
or die("Falha na SP (1)");
?>
<?php
while ($linha = mysql_fetch_assoc($resultado))
{
$ValorAtributo = $linha[ValorAtributo];
$CodAtributoValor = $linha[CodAtributoValor];
echo $ValorAtributo." ($CodAtributoValor)<br>";
?>
<? $resultado2 = mysql_query( 'CALL SpMenuSubConsulta(5)' ) or die(mysql_error()); ?>
<?php
while ($linha2 = mysql_fetch_assoc($resultado2))
{
$ValorAtributo = $linha2["ValorAtributo"];
echo "--Sub".$ValorAtributo."<br>";
}
?>
<?
}
?>
People don’t forgive, 1 minute and 2 negative. They should use this effort to help, but anyway. I didn’t understand why you were using CALL Spmenusubconsulta(5) in a query. Can you explain?
– Diego
A possible problem is the use of obsolete functions
mysql_*
that do not work properly with SP.– rray
Um? I didn’t understand the first comments rs yes. Next... I need 2 selections in this case, take the data from one SP and use in another SP with the while
– Josias Viskoo
And which one would you use instead? @rray
– Josias Viskoo
Which error appears? is something like out Sync?
– rray
Exactly @rray "Commands out of Sync; you can’t run this command now"
– Josias Viskoo
It is possible to solve in some ways, if it is not possible to exchange the functions for the
MySQLi
or PDO can store the result of the first SP in an array after doing a foreach with it and calling the second inside, maybe there is another way but these are the ones I remember now xD– rray
Already great brother @rray I’m going to test these two, solving back to publish the resolution!! Tks, thanks Brothers
– Josias Viskoo
Diego, I think the same thing expensive, If they used this to help would be much more productive, it seems that they have already accustomed to negativize everything, I asked a question and in a few minutes they had 2 negatives and soon after rose to 2 positive and 2 response each with 1 postivo... Now think... Those who negatively they negatively why?? if the question was inside the conforms and gained positivity?? See? There’s something very wrong about it People prefer to just get in the way instead of helping.
– Viniam
Got it now for Diego! really rs
– Josias Viskoo