Slow response (PHP MYSQL) [closed]

-1
<?php

require('DB.class.php');


//$conexao = mysql_connect('xxx.xxx.xxx.xxx','base_dados','utilizador');

//$db      = mysql_select_db('base_dados',$conexao);


$SQl_list = DB::getConn()->prepare("SELECT * FROM 'wpr3_posts' WHERE post_content LIKE '%perfil.mercadolivre.com.br/MARCH+GOLD%'");

$SQl_update = DB::getConn()->prepare("UPDATE 'wpr3_posts' SET  'post_content' = ? WHERE ID = ?");

$SQl_list -> execute();

var_dump( DB::getConn());

while ($res = $SQl_list->fetch(PDO::FETCH_ASSOC)){
    $h    = str_replace('https://perfil.mercadolivre.com.br/MARCH+GOLD', 'http://perfil.mercadolivre.com.br/MARCH+GOLD', $res['post_content']);

    $SQl_update -> execute(array($h,$res['ID']));
}

This code is not mine, the problem is that with this coding the site in general was slow, I would like to know what the problem is and how can I fix it. I was told that the problem is also that it replaced more images that were not to be replaced, probably it pulled more images than it should and now to load the database, it was complicated. Thank you in advance!

    
asked by anonymous 02.05.2017 / 17:48

2 answers

1

Friend, this technology has been deprecated since PHP version 5 and was removed with version 7. I recommend using the mysqli or PDO library to connect to the database using PHP.

    
04.05.2017 / 03:00
0

One way to improve access is instead of using SELECT * is to put the name of the fields. Review obsolete technologies, they also delay the code. Review the DB.class.php file to see how the connection is being made.

    
08.05.2017 / 22:34