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

  • Home
  • SEARCH
  • 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 226847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:32:57+00:00 2026-05-11T19:32:57+00:00

I don’t understand the concept of the fetch function. I am doing a tutorial

  • 0

I don’t understand the concept of the fetch function.

I am doing a tutorial from ‘PHP Solutions’ book and i am using MySQL Improved to update something in the database.

Here is the code:

$sql = 'SELECT article_id, title, article FROM journal WHERE article_id = ?';
$stmt = $conn->stmt_init();
$stmt->prepare($sql);
$stmt->bind_param('i', $_GET['article_id']);                    
$stmt->bind_result($article_id, $title, $article); 
//execute the query, and fetch the result
$stmt->execute(); 
$stmt->fetch();

So what is the fetch actually doing? I thought the execute() function is sending the information to the database and then it returns a true/false value to the $OK variable.

Is fetch() storing something in $stmt? Anybody have any idea what it is doing?

  • 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-05-11T19:32:58+00:00Added an answer on May 11, 2026 at 7:32 pm

    mysqli_stmt_fetch fetches the current row from the resultset and assigns the row values to variables previously bound to the prepared statement with mysqli_stmt_bind_result.

    Which means that you must call $stmt->bind_result(...); first, as it can be seen in the example from the man page.

    Note that nowadays using mysqli_stmt_fetch is considered inconvenient. Either use mysqli_stmt_get_result followed by familiar mysqli_fetch_* functions, or even avoid the entire bind param hassle with mysqli_execute_query().

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

Sidebar

Ask A Question

Stats

  • Questions 296k
  • Answers 296k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Like this: obj.GetType().GetGenericTypeDefinition() == typeof(Predicate<>) May 13, 2026 at 7:01 pm
  • Editorial Team
    Editorial Team added an answer when you .click() the child input, the event bubbles up… May 13, 2026 at 7:01 pm
  • Editorial Team
    Editorial Team added an answer As you have built it (which is bizarrely), the procedure… May 13, 2026 at 7:01 pm

Related Questions

In order to apply a triggered animation to all ToolTip s in my app,
I've got a string that has curly quotes in it. I'd like to replace
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I don't know when to add to a dataset a tableadapter or a query
I don't edit CSS very often, and almost every time I need to go

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.