-2
@$sql_usuario = "SELECT * FROM usuario ";
@$qry_usuario = @mysql_query($sql_usuario );
@$linha_usuario = mysql_fetch_array($qry_usuario );
Array ( [0] => 6 [u_id] => 6 [1] => 54354554[u_cod] => 54354554[2] => 54354554[u_cod] => 54354554) Array ( [0] => 17 [u_id] => 17 [1] => 323232323[u_cod2] => 3232323[2] => 3232323[u_cod2] => 3232323)
I have this query
. How I would convert to PDO
? The return of data is different:
@$sql_usuario = $dbconn->prepare("SELECT * FROM usuario");
@$sql_usuario->execute();
@$linha_usuario = $sql_usuario->fetch(PDO::FETCH_ASSOC);
Array ( [u_id] => 6 [u_cod] => 54354554[u_cod] => 54354554) Array ( [u_id] => 17 [u_cod2] => 3232323[u_cod2] => 323232323)
I didn’t get that
@
at the beginning of the variables. I posted in the answer an extremely simple example, which will assist you in the question. If you have any questions, ask.– rbz
Using PDO is the safest way to connect to a PHP BD?
– rray
@ is not to give empty index error
– Aprendiz
The output of the data in the case the fetchs are different understand, I would like them to follow a pattern
– Aprendiz
@Apprentice Yes, but there is no reason to "hide" the error, because it is a "mistake", should be treated. When to the "standard" of "fetchs" I did not understand. Edit your question, detail, exemplify.
– rbz