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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:06:52+00:00 2026-06-14T22:06:52+00:00

its a little difficult to explain. I’ve build the mysql function which works fine

  • 0

its a little difficult to explain. I’ve build the mysql function which works fine and with the depreciation of mysql I will need to change this function to use mysqli rather than the mysql method.
I current have:

$con = mysql_connect("host", "username", "pass");
mysql_select_db("db", $con);
$Username = mysql_real_escape_string($_POST['user']);
$Password = hash_hmac('sha512', $_POST['pass'], '&R4nD0m^');
$Query = mysql_query("SELECT COUNT(*) FROM users WHERE username = '{$Username}' AND password = '{$Password}'") or die(mysql_error());
    $Query_Res = mysql_fetch_array($Query, MYSQL_NUM);
    if($Query_Res[0] === '1')
    {
        //add session
        header('Location: newpage.php');
    }
            else {
                echo 'failed login';
            }

Now I’ve applied mysqli to this and it’s not returning any data or errors but the function still complies.

$log = new mysqli("host", "user", "pass");
$log->select_db("db");
$Username = $log->real_escape_string($_POST['user']);
$Password = hash_hmac('sha512', $_POST['pass'], '&R4nD0m^');
$qu = $log->query("SELECT COUNT(*) FROM users WHERE username = '{$Username}' AND password = '{$Password}'");
    $res = $qu->fetch_array();
    if($res[0] === '1'){
        //add session
        header('Location: newpage.php');
    }
    else {
        $Error = 'Failed login';
        sleep(0.5);
    }
    echo $res['username'].'              hello';
}

But I’m unsure on why this is wrong. I know it’s probably a simply answer

  • 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-14T22:06:52+00:00Added an answer on June 14, 2026 at 10:06 pm

    Just to have it as an answer:

    http://php.net/manual/en/pdo.prepared-statements.php
    http://php.net/manual/en/pdo.prepare.php

    e.g.

    $stmt = $dbh->prepare("INSERT INTO REGISTRY (name, value) VALUES (:name, :value)");
    $stmt->bindParam(':name', $name);
    $stmt->bindParam(':value', $value);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a nice little game which works well in its .fla form. Because
It's a little bit difficult to explain what I need, so I'll use some
Its a little difficult to explain. It might be easier to skip to the
I need some help with overlaying views using the prism framework.Its a little more
It's a little difficult to explain, but what I am trying to achieve is
The objective is a little bit difficult to explain, so please, notify me if
its a little bit hard to understand. in the header.php i have this code:
I am trying to create my own little MVC system, its working very well,
Maybe my question it's a little weird, but I'm trying to build a not-so-simple
Was little bit difficult to formulate the title for my question since is kind

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.