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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:55:01+00:00 2026-06-15T02:55:01+00:00

Everything with it is fine. The name of the database and table, the name

  • 0

Everything with it is fine. The name of the database and table, the name of the columns etc. $username is good and exists in the database. Yet, after this runs, if I “alert” $dbuid it comes up as 0 and $dbusername comes up as empty. MySQLi throws no errors. (That is why I did if(! .. ) echo error;, to see if it throws an error on anything, but it works perfectly fine.) Where am I going wrong ?

if(!$msmysqli = new mysqli("localhost","root","","ms")){
   echo $msmysqli->connect_error;
}
if(!$stmt = $msmysqli->prepare("SELECT id,name,password FROM accounts WHERE name=?")){
   echo $msmysqli->error;
}
if(!$stmt->bind_param("s",$username)){
   echo $stmt->error;
}
if(!$stmt->execute()){
   echo $stmt->error;
}
if(!$stmt->bind_result($dbuid,$dbusername,$dbpassword)){
   echo $stmt->error;
}
$stmt->close();
  • 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-15T02:55:03+00:00Added an answer on June 15, 2026 at 2:55 am

    You simply forgt to fetch your result to get the row… thats why your code wasn’t working as expected! Another thing to bare in mind is that an object, at least in php, returns always its instance while being constructed! The statement $msmysqli = new mysqli(…) is never going to be false! thats why you should check your connection as shown!

    $msmysqli = new mysqli("localhost","root","","ms");
    
    if ( $msmysqli->connect_errno ) echo $msmysqli->connect_error;
    
    if( $stmt = $msmysqli->prepare("SELECT id,name,password FROM accounts WHERE name=?") ) {
        $stmt->bind_param("s",$username);
        $stmt->execute();
        $stmt->bind_result($dbuid,$dbusername,$dbpassword);
        $stmt->fetch();
        $stmt->close();
    } else {
        echo $msmysqli->error;
    }
    
    $msmysqli->close(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When this one runs everything goes fine: (r^newobject$, views.myobjects.newobject), All the CSS + JS
We have a database with a tables called 'Sites' This table has the columns,
I have the following database design: Employee Table: Username, Name, JobTitle, BadgeNo, IsActive, DivisionCode
I have two tables in my database as following: Employee Table: Username, Name, Job,
So I'm trying to make a database which has name, calorie, and protein columns.
I have checked everything and the creating of the database is fine its when
I started using Zend_Paginator, it works everything fine but I noticed that there is
i implemented a listview which implements SectionIndexer ... everything fine so far. Normally the
Everything's fine building in xcode and testing the app until I built in for
Everything is fine and the final problem is so annoying. Compile is great but

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.