Welcome! Log In Create A New Profile

Advanced

[PHP] Deprecated features in php 7.1

Posted by Release Edl 
Release Edl
[PHP] Deprecated features in php 7.1
February 23, 2017 04:20PM
The script bellow is working properly under php 5.6, but not in php 7.1.
What could we do to fix it?

<?php

include("_restrito/conexao.php");

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

if(!$conexao)

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

mysql_select_db($db) or die("Nao foi possivel usar o banco de dados.
Erro: " . mysql_error());

$pagina = $_GET['pagina'];

$banco = mysql_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 = mysql_query("$busca LIMIT $inicio,$total_reg");
$todos = mysql_query("$busca");

$tr = mysql_num_rows($todos);
$tp = $tr / $total_reg;
while ($dados = mysql_fetch_array($limite)) {

?>

Thanks in advance for any help.
Att.,
Paulo


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Ryan Pallas
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 04:40PM
See http://php.net/manual/en/changelog.mysql.php the extension was removed
in 7.0

On Thu, Feb 23, 2017 at 8:11 AM, Release Edl <[email protected]
> wrote:

> The script bellow is working properly under php 5.6, but not in php 7.1.
> What could we do to fix it?
>
> <?php
>
> include("_restrito/conexao.php");
>
> $conexao = mysql_connect($host,$user,$pass,$db);
>
> if(!$conexao)
>
> die("Nao foi possivel conectar no servidor MySQL. Erro: " .
> mysql_error());
>
> mysql_select_db($db) or die("Nao foi possivel usar o banco de dados.
> Erro: " . mysql_error());
>
> $pagina = $_GET['pagina'];
>
> $banco = mysql_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 = mysql_query("$busca LIMIT $inicio,$total_reg");
> $todos = mysql_query("$busca");
>
> $tr = mysql_num_rows($todos);
> $tp = $tr / $total_reg;
> while ($dados = mysql_fetch_array($limite)) {
>
> ?>
>
> Thanks in advance for any help.
> Att.,
> Paulo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ashley Sheridan
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 05:00PM
On 23 February 2017 15:11:57 GMT+00:00, Release Edl <[email protected]> wrote:
>The script bellow is working properly under php 5.6, but not in php
>7.1.
>What could we do to fix it?
>
><?php
>
>include("_restrito/conexao.php");
>
> $conexao = mysql_connect($host,$user,$pass,$db);
>
> if(!$conexao)
>
> die("Nao foi possivel conectar no servidor MySQL. Erro: " .
>mysql_error());
>
> mysql_select_db($db) or die("Nao foi possivel usar o banco de dados.
>Erro: " . mysql_error());
>
> $pagina = $_GET['pagina'];
>
> $banco = mysql_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 = mysql_query("$busca LIMIT $inicio,$total_reg");
>$todos = mysql_query("$busca");
>
>$tr = mysql_num_rows($todos);
>$tp = $tr / $total_reg;
>while ($dados = mysql_fetch_array($limite)) {
>
>?>
>
>Thanks in advance for any help.
>Att.,
>Paulo

You shouldn't be using the mysql_* functions, and they've been deprecated for years. I'd recommend using PDO instead.

Thanks,
Ash

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 05:00PM
On Thu, Feb 23, 2017 at 10:51 AM, Ashley Sheridan <[email protected]>
wrote:

>
>
> On 23 February 2017 15:11:57 GMT+00:00, Release Edl <
> release_editorial@terra.com.br> wrote:
> >The script bellow is working properly under php 5.6, but not in php
> >7.1.
> >What could we do to fix it?
> >
> ><?php
> >
> >include("_restrito/conexao.php");
> >
> > $conexao = mysql_connect($host,$user,$pass,$db);
> >
> > if(!$conexao)
> >
> > die("Nao foi possivel conectar no servidor MySQL. Erro: " .
> >mysql_error());
> >
> > mysql_select_db($db) or die("Nao foi possivel usar o banco de dados.
> >Erro: " . mysql_error());
> >
> > $pagina = $_GET['pagina'];
> >
> > $banco = mysql_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 = mysql_query("$busca LIMIT $inicio,$total_reg");
> >$todos = mysql_query("$busca");
> >
> >$tr = mysql_num_rows($todos);
> >$tp = $tr / $total_reg;
> >while ($dados = mysql_fetch_array($limite)) {
> >
> >?>
> >
> >Thanks in advance for any help.
> >Att.,
> >Paulo
>
> You shouldn't be using the mysql_* functions, and they've been deprecated
> for years. I'd recommend using PDO instead.
>
> Thanks,
> Ash
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Your options are (listed form best to worst):

1) Upgrade your code to use PDO or MySQLI (most code change)
2) Use a MySQL PDO wrapper (least code change) like
https://github.com/AzizSaleh/mysql
3) Downgrade and do nothing

If the above file is the only file accessing MySQL then I suggest you
change it to PDO/MySQLI it would be easy and a good learning experience. If
however, you are using an old framework or custom code that doesn't easily
support the upgrade use a wrapper.
Shawn McKenzie
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 05:30PM
Those functions were removed in PHP 7. PIck MySQLi or PDO:
http://php.net/manual/en/mysqlinfo.api.choosing.php

On Thu, Feb 23, 2017 at 9:11 AM, Release Edl
<[email protected]> wrote:
> The script bellow is working properly under php 5.6, but not in php 7.1.
> What could we do to fix it?
>
> <?php
>
> include("_restrito/conexao.php");
>
> $conexao = mysql_connect($host,$user,$pass,$db);
>
> if(!$conexao)
>
> die("Nao foi possivel conectar no servidor MySQL. Erro: " .
> mysql_error());
>
> mysql_select_db($db) or die("Nao foi possivel usar o banco de dados.
> Erro: " . mysql_error());
>
> $pagina = $_GET['pagina'];
>
> $banco = mysql_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 = mysql_query("$busca LIMIT $inicio,$total_reg");
> $todos = mysql_query("$busca");
>
> $tr = mysql_num_rows($todos);
> $tp = $tr / $total_reg;
> while ($dados = mysql_fetch_array($limite)) {
>
> ?>
>
> Thanks in advance for any help.
> Att.,
> Paulo
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Michelle Konzack
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 08:00PM
Hello Shawn,

On 2017-02-23 10:19:56 Shawn McKenzie hacked into the keyboard:
> Those functions were removed in PHP 7. PIck MySQLi or PDO:
> http://php.net/manual/en/mysqlinfo.api.choosing.php

Does this also concern PostgreSQL?

Thanks in avance

--
Michelle Konzack Miila ITSystems @ TDnet
GNU/Linux Developer 00372-54541400
Lester Caine
Re: [PHP] Deprecated features in php 7.1
February 23, 2017 08:50PM
On 23/02/17 18:58, Michelle Konzack wrote:
> On 2017-02-23 10:19:56 Shawn McKenzie hacked into the keyboard:
>> Those functions were removed in PHP 7. PIck MySQLi or PDO:
>> http://php.net/manual/en/mysqlinfo.api.choosing.php
> Does this also concern PostgreSQL?

Nothing what so ever ... the OLD MySQL API has not been supported for
some considerable time.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk
Rainbow Digital Media - http://rainbowdigitalmedia.co.uk

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sorry, only registered users may post in this forum.

Click here to login