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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:18:01+00:00 2026-05-22T17:18:01+00:00

[UPDATED] with new code sql_real_escape_string() [UPDATED] if anyone wants to look at the site

  • 0

[UPDATED] with new code “sql_real_escape_string()”
[UPDATED] if anyone wants to look at the site its at Test site
[UPDATED] with the while code showing any results via echo

Hello All,

I have looked at many posts on this matter, but simply cannot understand why the following code doesn’t work:

    $username = $_POST['username'];

    // get the record of the user, by looking up username in the database.  
    $query = sprintf("SELECT UserName, Password FROM userlogin WHERE UserName='%s'", mysql_real_escape_string($username));

    $result = mysqli_query($dbc, $query) or 
        die ("Error Querying Database for: " . $query . 
        "<br />Error Details: " . mysql_error() . "<br/>" . $result);

while ($row = mysqli_fetch_assoc($result))
{
         Echo($row['UserName']);
}

The Code seems to be correct… the database is working perfectly (for input purposes) and the connection is a shared connection applied with require_once(‘databaseconnection.php’); that is working for the registration side of things.

like normal I’m sure this is something simple that I have overlooked but cannot for the life of me see it!

I do not get any error messages from the myssql_error() its simply blank.

any help would be much appreciated.

Regards

  • 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-22T17:18:01+00:00Added an answer on May 22, 2026 at 5:18 pm

    Check the username you try to query as it might be empty. Do you really use a post-request to run that script? How do you verify that it does not work? What do you do with $data after the query?

    If just nothing seems to happen it is likely your query did not match any record. Check for whitespace and case of the username you are looking for.

    Mind those warnings:

    • Use a prepared statement or at least sql-escape any user-input before using it in sql.
    • Don’t use die in serious code only for debugging.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently updated to the new version of XCode and the session start code
Okay I have updated my code quite a bit. I am getting a new
the following code (from a database object created for each new view): -(void)update:(NSString *)queryText{
I'm trying to update/change contact ringtone using this code: ContentValues values = new ContentValues();
yesterday we updated to a new version of some middleware we are using, and
Updated question, see below I'm starting a new project and I would like to
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
My zune just updated to 3.0 (didn't even realize they were releasing something new!)
I have just updated to the latest structuremap dll and now my site no
CURRENT PROGRESS TOWARD SOLUTION: This is the updated code: sql = INSERT INTO Strings

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.