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 6797647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:38:03+00:00 2026-05-26T18:38:03+00:00

My function gets $status (0-error, 1-success), $err_id (id of error message in db) and

  • 0

My function gets $status (0-error, 1-success), $err_id (id of error message in db) and $field (name of input field) variable and fetches error message from db, with given vars.

Tried die() in every step to detect where error occuring, also placed die($status.$err_id.$field); right after function err. No success.

Debuged with netbeans. Marked the line in which debug stops in function

$msg is always null. Can’t fetch it from db. There is no error in php error log. May be my code has mistake? Please take a look.

function err($status, $err_id = 0, $field = 0)
{
        global $db;
        if ($status == 0) {
                $stmt = $db->prepare("SELECT msg FROM err_msgs WHERE field = ? AND id= ?") or die(htmlspecialchars($db->error));
                $stmt->bind_param("si", $field, $err_id) or die(htmlspecialchars($stmt->error));
                $stmt->execute() or die(htmlspecialchars($stmt->error));
                $stmt->bind_result($msg) or die(htmlspecialchars($stmt->error));

                >>debug stops here>> $stmt->fetch() or die(htmlspecialchars($stmt->error));

                response('error', $msg);
                $stmt->close();
                die();

        } else {
                response('success', 'Success!');

        }

}
  • 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-26T18:38:04+00:00Added an answer on May 26, 2026 at 6:38 pm

    I forgot to fetch after binding result

    $stmt->fetch()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my Java code I have function that gets file from the client in
I have this function in jQuery that gets data from a page with POST,
According to the doc, the 'error' ajax event gets passed the XMLHttpRequest object, 'success'
It looks like jQuery's .ajax function fires the 'success' function even when it gets
I have a simple function about neural network. This function gets a matrix, loads
I am trying to call terminate function. [I think this function gets called when
I'm using C++ map to implemented a dictionary in my program. My function gets
I'm trying to write a php function that gets all the basic food data.
The install.packages() function in R is the automatic unzipping utility that gets and install
invalidHandler function doesn't get called on validation on keypress or blur. It gets called

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.