-1
I am trying to make a connection via php to a mysql server but always presents the following error:
Warning: mysql_select_db() expects Parameter 2 to be Resource, null Given in /home/u517649386/public_html/conecta.php on line 6
The code used is as follows::
<?php
$banco = new PDO('mysql:host=mysql.hostinger.com.br;u517649386_teste', 'u517649386_teste','senha')or die(mysql_error());
print "Conexão efetuada com sucesso!";
mysql_select_db('u517649386_teste', $con);
print "Conexão e Seleção OK!"; 
if($_GET['acao'] == 'listapizzas'){
     $sql = "SELECT * FROM `pizzas` LIMIT 0, 30 ";
     $re = mysql_query($SQL, $serve);
     $num = mysql_num_rows($re);
     if($num > 0){
           while($Linha = mysql_fetch_object($re)){
                  echo "{$Linha->Nome}<br />";
           }
      }
      else{
          echo 'nenhuma pizza cadastrada';
      }
}
?>  
The php version of the server is 5.5.35
$conshould not have a connection vc should use only PDO, functionsmysql_*were removed from the newer versions of php– rray
Since the 'mysql_*' functions have been removed which I can use instead?
– Yuri Ruan
Use PDO or Mysqli functions, what changes basically is that the connection should be passed as first argument in most functions, can look that answer
– rray
Follow the examples of the documentation friend, don’t try to do things in your head, learn how it works.
– Guilherme Nascimento