Ver Mensaje Individual
  #1 (permalink)  
Antiguo 18/03/2016, 16:26
domichis
 
Fecha de Ingreso: julio-2014
Mensajes: 59
Antigüedad: 9 años, 8 meses
Puntos: 0
Pasar de mysql a mysqli

Hola buen dia tengo una duda sobre como pasar de mysql a mysqli tengo este codigo.

Código PHP:
<?php
                     
if(count($_SESSION['carrinho']) == 0){
                        echo 
'<tr><td colspan="5">Não há produto no carrinho</td></tr>';
                     }else{
                        require(
"conexao.php");
                                                               
$total 0;
                        foreach(
$_SESSION['carrinho'] as $id => $qtd){
                              
$sql   "SELECT *  FROM produtos WHERE id= '$id'";
                              
$qr    mysql_query($sql) or die(mysql_error());
                              
$ln    mysql_fetch_assoc($qr);
                               
                              
$nome  $ln['nome'];
                              
$preco number_format($ln['preco'], 2',''.');
                              
$sub   number_format($ln['preco'] * $qtd2',''.');
                               
                              
$total += $ln['preco'] * $qtd;
                            
                           echo 
'<tr>       
                                 <td>'
.$nome.'</td>
                                 <td><input type="text" size="3" name="prod['
.$id.']" value="'.$qtd.'" /></td>
                                 <td>R$ '
.$preco.'</td>
                                 <td>R$ '
.$sub.'</td>
                                 <td><a href="?acao=del&id='
.$id.'">Remove</a></td>
                              </tr>'
;
                        }
                           
$total number_format($total2',''.');
                           echo 
'<tr>
                                    <td colspan="4">Total</td>
                                    <td>R$ '
.$total.'</td>
                              </tr>'
;
                     }
               
?>