Jump to content
aHMAD_SQaLli

mysqli prepared statement mysqli_fetch_array()

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 :)

 

Share this post


Link to post
Share on other sites

NO HELP ??? !!! ...

 

Apologies for not being online when you posted. Had I known you were in such a hurry I would have sat in front of my screen all day just waiting for you to post a problem.

  • Like 1

Share this post


Link to post
Share on other sites

Apologies for not being online when you posted. Had I known you were in such a hurry I would have sat in front of my screen all day just waiting for you to post a problem.

Brilliant! Haha

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • 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.