Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9061105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:24:07+00:00 2026-06-16T15:24:07+00:00

Which is faster? Fetching array with mysqli prepared statement: $statement=$mysqli->prepare(SELECT `name`,`age` FROM `users` WHERE

  • 0

Which is faster? Fetching array with mysqli prepared statement:

    $statement=$mysqli->prepare("SELECT `name`,`age` FROM `users` WHERE `id`=?");
    $statement->bind_param('i',$id);
    $statement->execute();
    $statement->bind_result($array['0'],$array['1']);
    $statement->fetch();
    return $array;

Or fetching array with mysqli only:

return $mysqli->query("SELECT `name`,`age`FROM `users` WHERE `id`='".$id."'")->fetch_row();

EDIT: Use only prepared statements, because normal queries are NOT SAFE! Do not worry about performance – worry about security!

EDIT2: Recently I started using PDO instead of MySQLi. PDO is better than MySQLi extension in many ways. One of them is fetching and looping through a multidimensional array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:24:08+00:00Added an answer on June 16, 2026 at 3:24 pm

    There is a strict rule: bother yourself with performance questions only if you have strong reason to.
    Otherwise you would either just waste your time or even make things worse.

    In your particular case, a difference, even if exists, would be hardly noticeable.
    So, it’sproper design should be your concern, not imaginable “performance issue”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

which one is faster select * from parents p inner join children c on
Which is faster? SELECT UserName FROM dbo.UserTable WHERE UserID in (1,3,4) SELECT UserName FROM
Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc I
Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc. I
For reading the data from the database which is faster BCP or Data reader?
Which is faster to retrieve information from, an object or a simple calculation? Is
Was curious to know which is faster - If i have an array of
In jQuery, which is faster to execute: $(li).last() or $(li:last-child) ?
Which is faster to load in android, a file from external storage or a
Possible Duplicate: Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.