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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:41:39+00:00 2026-05-31T01:41:39+00:00

I work with xampp. I performed MySQL connection: $connection = mysql_connect($host , $user ,

  • 0

I work with xampp. I performed MySQL connection:

$connection = mysql_connect($host , $user , $passw);
mysql_select_db($db, $connection);

I received output with echo command (by check the boolean returned values) that connection is established and the database $db is found.

But the simplest query like:

$query = mysql_query("SELECT * FROM 'users'");

returns false. How can I debug why?Thanks.

  • 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-31T01:41:40+00:00Added an answer on May 31, 2026 at 1:41 am

    An obligatory update: as mysql ext is no more, here are answers for two remaining MySQL APIs which I written on my site based on the experience from answering 1000s questions on Stack Overflow:

    • How to report errors in mysqli
    • How to connect to MySQL using PDO (with the aim of the proper error reporting).

    In short, for mysqi the following line have to be added before mysqli_connect() call:

    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
    

    while for PDO the proper error mode have to be set, for example

    $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
    

    As of the old mysql ext,

    To get an error from mysql_query() you have to use mysql_error() function.
    So always run all your queries this way, at least until you develop a more advanced query handler:

    $query = "SELECT * FROM 'users'";
    $result = mysql_query($query) or trigger_error(mysql_error()." ".$query);
    

    the problem with your current query is 'users' part. Single quotes have to be used to delimit strings while for the identifiers you have to use backticks:

    SELECT * FROM `users`
    

    In order to see these errors during development, add these lines at the top of your code to be sure you can see every error occurred

    ini_set('display_errors',1);
    error_reporting(E_ALL);
    

    on the production server, however, the value on the first line should be changed from 1 to 0

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

Sidebar

Related Questions

I currently work in a LAMP environment and use XAMPP to setup my dev
I have tried several times now to get cURL to work using xampp, whith
i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql
My xampp installation 1.7.4 in windows 7 does not seem to work. http://localhost returns
I have a MySQL statement in a function but somehow it doesn't work. I
I ran the following query in MySQL command line and the tables were created.
I usually develop websites on the WAMP/XAMPP and host it on Linux servers. All
I used to work with XAMPP to build PHP applications. Once I tried Zend
work on asp.net vs 05 C#.Master page header contain the bellow code <script type=text/javascript
work on SQL Server 2000. want to Automated Email Notifications using SQL Server Job

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.