does anyone know how to solve an error in website hosting?

1

someoneknowhowtosolvealocaweberrorinaddition

$stmt=mysqli_prepare($mysqli,$sql);mysqli_stmt_bind_param($stmt,'i',$id);mysqli_stmt_execute($stmt);$result=mysqli_stmt_get_result($stmt);

Itdoesnotcarrytheproposedfunctioninlocawebhosting.Idecidedtogiveavardumponmynolocalhostanditbringsmetheresultshoweverinlocawebitdoesnotbringmetheseresults.Ireadthatitcouldbetheversionbecauseinlocawebthedefaultandversion5.2ofphpintaoIchangedtheversionto5.6butnothingdoesnotappeartheresultscouldanyonehelpme?

Goodonmydetailpagehasthiscode:

$id=$_GET['cod'];$sqql=mysqli_query($mysqli,"SELECT * FROM produtos WHERE id_produto = $id");
                        $test = mysqli_query($mysqli, "SELECT votos, pontos FROM produtos WHERE id_produto = $id");

                        $aux = mysqli_fetch_array($sqql);
                        $idprod = $aux['id_produto'];

                        $row = mysqli_fetch_array($test);
                        $voto = $row['votos'];
                        $ponto = $row['pontos'];
                        $calc = round(($ponto/$voto),1);

Until this section is working, I gave var_dump($idprod) and it returns the id of the right product, but now it has the part that brings the result:

$sql = "SELECT * FROM produtos WHERE id_produto = ?";
                        $stmt = mysqli_prepare($mysqli, $sql);
                        mysqli_stmt_bind_param($stmt, 'i', $id);
                        mysqli_stmt_execute($stmt);
                        $result = mysqli_stmt_get_result($stmt);
                while ($aqq = mysqli_fetch_assoc($result)){

                   $nome = $aqq['nome'];
                   $desc = $aqq['descricao'];
                   $preco = $aqq['preco'];
                   $img = $aqq['img'];

already here in this section I gave var_dump($nome) the right would be it show me string aaaa but it does not show me anything in locaweb, however I executed the same var_dump in my localhost and even in the same place it returns me string aaaa

    
asked by anonymous 19.12.2015 / 16:25

1 answer

0

If you can not install mysqlnd in your hosting, change get_result () by bind_result () , which changes is the return the first method returns an array the second N variables one for each field of the field list.

Substitute:

mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt); 

The code below will be applied to this query SELECT * FROM produtos WHERE id_produto = ? , the table appears to have 4 fields.

By:

mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $nome, $preco, $descricao, $imagem);
while (mysqli_stmt_fetch($stmt)) {
    echo $nome .' - '. $preco .' - '. $descricao .' - '. $imagem .'<br>;
}
mysqli_stmt_close($stmt);
    
19.12.2015 / 21:49