Jump to content

mysqli prepared statement mysqli_fetch_array()


aHMAD_SQaLli

Recommended Posts

Hello every one

so, I've been using mysql for almost 2years and I've heard that using MySQLi is more secure and I m still new in the prepared statement thing that's why I was wandering how to do this prepared statement with arrays ??

in an example I have this code, how can I execute it with prepared statement ?

$sql = mysqli_query($con, "SELECT users.regdate, topics.topic_body FROM `users` LEFT JOIN topics ON topics.topic_author = users.id WHERE topics.id=1 order by topic_edit_time ASC");
if( mysqli_num_rows($sql)>0 ) {
    while($row = mysqli_fetch_array($sql)) {
        echo htmlentities($row['regdate']) . "<br>" ;
        echo htmlentities($row['topic_body']);
    }
}
else { echo 'not found'; }

Thanks :)

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.