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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:39:40+00:00 2026-06-14T21:39:40+00:00

$mysqli = mysqli_connect(localhost, root, pass, test); function check_login($mail,$pwd){ global $mysqli; if($stmt= $mysqli->prepare(‘SELECT COUNT(*) FROM

  • 0
$mysqli = mysqli_connect("localhost", "root", "pass", "test");

function check_login($mail,$pwd){   
    global  $mysqli;    
    if($stmt=  $mysqli->prepare('SELECT COUNT(*) FROM `users` WHERE mail = ? AND pwd = MD5(?)')){
        $stmt->bind_param("ss", $mail, $pwd);       
        $stmt->execute();
        $stmt->bind_result($count);
        $stmt->close();
        var_dump($count);
    }
    return ($count > 0 ? true : false);
}

check_login('test@gmail.com','pass');

I have write this script by seeing some script on stackoverflow.I tried to run it and found that $count is NULL after script execute.

I want to know why this is not worked for me. I have tried to run same command on Mysql and it’s show me result.

someone help me on it..

  • 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-14T21:39:41+00:00Added an answer on June 14, 2026 at 9:39 pm

    mysqli::bind_result needs to be invoked after the ->execute and before the ->fetch call. The fetch() isn’t optional, as the (bound result) variable reference is merely an alternative to extracting the result row manually.

    So in your code:

        $stmt->execute();
        $stmt->bind_result($count);
        $stmt->fetch();  // result array thrown away
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

code: sql.php <?php $uid = trim($_POST['uid']); $pass= trim($_POST['pass']); $type= trim($_POST['type']); $link = mysql_connect(localhost,root,akash); if
I am calculating one parameter(X) this way: <?php $link=mysql_connect(localhost,root,); mysql_select_db(hand); $result = mysql_query(select *
<?php ini_set('display_errors', 0); $search = $_GET ['search']; mysql_connect(localhost, root, gokul); mysql_select_db(search123); $query = mysql_query(SELECT
$s = explode ( , microtime()); $s = $s[0]+$s[1]; $con = mysqli_connect ('localhost', 'test',
Updated script with proper field names. Why isnt this working? <?php $con = mysql_connect(localhost,root,pass);
$con = mysql_connect(localhost,root,); if (!$con) die('Could not connect: ' . mysql_error()); mysql_select_db(pilot, $con); $sql
I have this code $con = mysql_connect(localhost,root,); if (!$con) { die('Could not connect: '
Ok, I have this code. $con = mysql_connect(localhost,root,); if (!$con) { die('Could not connect:
<? class DbConn { const DB_HOST = 'localhost'; const DB_USER = 'root'; const DB_PASS
Here is the code that I'm working on: login.php: <?php $con = mysql_connect(localhost,root,); mysql_select_db(koro,$con);

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.