-3
I need to update a legacy code and for that I need to make two modifications to it.
The first change is to leave office mysql_*
and use the PDO.
The second is to update the database so that I can not register two usernames and password with the same values.
Code seeking the Nome
and imgPerfil
of a user:
<?php
require_once "includes/config.php";
$Usuario = $_SESSION["Usuario"];
$Senha = $_SESSION["Senha"];
$SQL = mysql_query("SELECT Nome, imgPerfil FROM administradores WHERE Usuario=$Usuario' AND Senha='$Senha' ");
Code that takes user values:
<?php
while($Linha = mysql_fetch_assoc($SQL)) {
$nomeUser = $Linha['Nome'];
$imgpUser = $Linha['imgPerfil'];
}
Code printing the values:
<?php echo $nomeUser; ?>
and
<?php echo $imgpUser; ?>
I can’t understand the question.
– mutlei
This tutorial shows how to use PDO, including Prepared Statements: http://www.ultimatephp.com.br/como-usar-pdo-com-banco-data
– Beraldo