2
I’d like to know how to use the mysql_result
in the mysqli
I’m not getting it, I was looking at the site php.net
and the only thing I saw was a mysqli_data_seek
if anyone can help me...
Code I’d like to pass to mysqli
:
$sql = mysqli_query($link, "SELECT * FROM produtos WHERE id_produto = $id");
if($id!=""){
$descricao = mysql_result($sql,0,"descricao");
$nome = mysql_result($sql,0,"nome");
$preco = mysql_result($sql,0,"preco");
$img = mysql_result($sql,0,"img");
}
It is impossible! this function does not exist, needs to work differently
– rray
I saw this mysli_data_seek rray but n intendi very well it
– Leonardo Costa
this would be the new method that is equal to mysql_result?
– Leonardo Costa
You can use it like this => Select with Prepared statements Mysqli
– rray
in my case then I would have to use the bind that Voce spoke on the topic?
– Leonardo Costa
Yes, this avoids sql Injection
– rray
Would it look like this in mine? $list = array(); $i = 0; while($query->fetch()){ $list[$i]['Description'] = $Description; $list[$i]['name'] = $name; $list[$i]['price'] = $price; $list[$i]['img'] = $img; $i++; Here would enter the print that has inside my if? and also I forget my if? }
– Leonardo Costa