Re: [PHP] Deprecated features in PHP 5.5.x

[email protected] ("Release Edl")
Newsgroups php.general
Message-ID <[email protected]>
Hi there,

Torsten gave a good help. Now I'm having a trouble with php 7.1. The script 
works properly in php 5.6:

<?php

include("_restrito/conexao.php");

 $conexao = mysqli_connect($host,$user,$pass,$db);

    if(!$conexao)

    die("Nao foi possivel conectar no servidor MySQL. Erro: " . 
mysqli_error());

    mysqli_select_db($conexao,$db) or die("Nao foi possivel usar o banco de 
dados. Erro: " . mysqli_error());

    $pagina = $_GET['pagina'];

    $banco = mysqli_select_db("mensagem");

 $busca = "SELECT * FROM portfolio ORDER BY id DESC";

 $total_reg = "5";
 if (!$pagina) {
    $pc = "1";
} else {
    $pc = $pagina;
}

$inicio = $pc - 1;
$inicio = $inicio * $total_reg;

$limite = mysqli_query("$busca LIMIT $inicio,$total_reg");
$todos = mysqli_query("$busca");

$tr = mysqli_num_rows($todos);
$tp = $tr / $total_reg;

while ($dados = mysqli_fetch_array($limite)) {

?>

Could you help?

"Torsten Rosenberger" <[email protected]> escreveu na mensagem 
news:1449494131.8731.20.camel@linux-j8s5...
> Hello
>
> Am Montag, den 07.12.2015, 11:07 -0200 schrieb Release Edl:
>> Hi people,
>>
>> How can I use the mysqli function to substitute of mysql ?
>>
>> I need to change an old script that uses mysql.
>>
>> The script::
>>
>> <?php
>>
>> include(conexao.php");
>>  $id = $_GET['id'];
>>  $conexao = mysql_connect('host', 'user', 'pass');
>>
>>     if(!$conexao)
>>
>>          die("Error: " . mysql_error());
>>
>>     mysql_select_db($db) or die("Error: " . mysql_error());
>>
>> $SQL = "SELECT * FROM portfolio WHERE id='$id' ORDER BY id DESC LIMIT 1";
>>
>> $query = mysql_query($SQL);
>>
>> while($x = mysql_fetch_array($query)) {
>>
>> ?>
>
> http://de.php.net/manual/en/book.mysqli.php
>
> take a look in the manual.
>
> most functions are the same but with mysqli in front.
>
> $link = mysqli_connect("127.0.0.1", "my_user", "my_password", "my_db");
>
> mysqli_select_db ( $link , $db );
> mysqli_query ( $link ,.....)
>
> so you have to rewrite the mysql with mysqli and add the connection to
> all other functions
>
>
> BR/Torsten
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.