Does anyone know how to fix a website hosting error?

Asked

Viewed 464 times

1

inserir a descrição da imagem aquiinserir a descrição da imagem aquisomeone knows how to fix an error in the

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

it does not bring the proposed function in the hosting of Locaweb. I decided to give a var dump in my localhost and he brings me the results but in Ocaweb he does not bring me those results. I read that it could be the version by which in Ocaweb the default and version 5.2 of php intao I changed the version to the 5.6 but nothing appears the results someone could help me?

good on my detail page has this code:

 $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 because I gave var_dump($idprod) and it returns me the id of the right product but continuing now 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 passage I gave var_dump($nome) it would be right for him to show me string aaaa but he won’t show me anything in Ocaweb, but I will run the same var_dump on my localhost and even at the same location there it returns me string aaaa

  • 1

    What error happens? if php5.2 is the default I would urgently change hosting.

  • does not show the error simply does not show my products anything related I vardump in it see what happened and nothing shows in the vardump already in localhost shows me the results of the vardump

  • 1

    At the top of the page put these two lines, ini_set('display_errors', true); error_reporting(E_ALL);

  • @rray would have some other way of using the method that returns the result to test if it really is the error? something that makes the same as mysql_result

  • Try to see the apache logs.

  • Call to undefined function mysqli_stmt_get_result() in /home/storage/d/8a/28/hospedagemdes1002/public_html/detalhe.php on line 324

  • You need mysql installed, http://php.net/manual/en/book.mysqlnd.php need to ask them to enable

  • I just asked them and that’s it?

  • In theory yes, send the manual link to them, explains q to work your code need this feature enabled

Show 4 more comments

1 answer

0


Not if it is not possible to install/ o mysqlnd in your accommodation, change get_result() for 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.

Subastitua:

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

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

For:

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);
  • I changed it but now it goes more than even the name the price to Description and the image it is bringing me NULL

  • also gives that error Warning: mysqli_stmt_bind_result(): Number of bind variables doesn't match number of fields in prepared statement in /home/storage/d/8a/28/hospedagemdes1002/public_html/detalhe.php on line 324 I did so mysqli_stmt_bind_result($stmt, $nome, $preco, $descricao, $imagem);while ($aqq = mysqli_stmt_fetch($stmt)) { $nome = $aqq['nome']; $desc = $aqq['descricao']; $preco = $aqq['preco']; $img = $aqq['img']; }

  • @Leonardocosta, for each field in the table you need a variable, the error says it has variables of less.

  • I did so now @rray and it came out the error of number of bin but it did not appear anything I gave the var_dump() dnv and it shows null mysqli_stmt_bind_result($stmt, $id, $nome, $descricao, $preco, $categoria, $img, $tipo, $size, $new, $vot, $po);&#xA; while ($aqq = mysqli_stmt_fetch($stmt)) {$id = $aqq['id_produto'];$nome = $aqq['nome'];$desc = $aqq['descricao'];$preco = $aqq['preco'];$categoria = $aqq['categoria'];$img = $aqq['img'];$tipo = $aqq['type'];$size = $aqq['size'];$new = $aqq['new'];$vot = $aqq['votos'];$po = $aqq['pontos'];var_dump($nome);

  • I took every field of the table I have in the product and passed but he brought me NULL in the var_dump($nome)

  • @Leonardocosta, you don’t have to do ... $aqq['nome'], only flame $nome

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.