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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:30:43+00:00 2026-06-17T11:30:43+00:00

I am upgrading my small project from MYSQL database into MYSQLi and I have

  • 0

I am upgrading my small project from MYSQL database into MYSQLi and I have only 3 functions left to update.

This is my function in MYSQL:

function id_from_username($username) {
    $username = sanitize ($username);
    return mysql_result(mysql_query("SELECT ´id´ FROM ´members´ WHERE ´username´ = '$username'"), 0, 'id');
}

I have this code which I tried to migrate into the function above but no use:

$result = "SELECT * FROM `settings`";
 if (!$row = $db_connect->query($result)) {
     die('Oops, something went wrong during loading data! Error x010');
 }

I know I am supposed to public the code I tried out, but the problem is I do not really know how to migrate the MYSQLi into just that specific function and I know that the code was wrong in all ways possible if so to say.

  • 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-17T11:30:44+00:00Added an answer on June 17, 2026 at 11:30 am

    I found the right answer, the code should be following:

    function id_from_username($username) {
        $username = sanitize($username);
        global $db_connect;
    
        $result = $db_connect->query("SELECT(id) FROM members WHERE username = '$username'");
        if (false === $result) {
            return false;
        }
        return ($result->num_rows === 1);
    }
    

    It’s simple and I still can stick to my code without integrating other scripts 🙂

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

Sidebar

Related Questions

In upgrading my application from v1 to v2, I've made a few small changes
Upon upgrading to Ubuntu 10.10 on our dev machine we run into a small
I am not sure if this is possible but I have a small web
I have a small deploy tool that I'm upgrading. The tool takes a version
i have a javascript function that creates inputfields for uploading images. i have this
I am upgrading a small app from Rails 3.0.9 to 3.2.6 and I getting
Upgrading from ASP.NET WebAPI Beta to RC has provided some amount of excitement and
After upgrading to a newer hibernate version (guess it came with the switch from
After upgrading from Spring 3.0.0.M4 to 3.0.0.RC1 and Spring Security 3.0.0.M2 to 3.0.0.RC1, I've
I have to make a maintenance release of a project that hasn't been touched

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.