1
Please anyone who can help me. The question is this, I need to extract two variables from an array and use them as an integer type to compare values between them. The code is this:
$sql = "SELECT *
FROM
inf_user
WHERE
login = '" . $login
."' and senha = '" . $senha ."'";
try{
$conn = new PDO('mysql:host=' . $servername . ';dbname=' . $dbname, $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$result = $conn->query($sql) or die('Nao foi possivel executar o comando.');
$rows = $result->fetch();
extract($rows);
//echo "\$limite = $limite; \$consultas = $consultas";
$limite = intval($limite);
$consultas = intval($consultas);
var_dump($limite);
The return of var_dump
is int(2)
, but I need it to be just the number 2
without the int()
. How do I do?
Does your string have a pattern? this looks like a field declaration (SQL). Remember that the
var_dump()
adds a formatting in the output. Check the output withecho
also.– rray