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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:36:00+00:00 2026-05-31T17:36:00+00:00

I created a script on a windows platform which connects to the mysql database

  • 0

I created a script on a windows platform which connects to the mysql database and returns the results of a table. A very basic script which I wrote to simply test my connection worked. The script works fine on my windows machine but not on my new mac. On the mac it simply does not display any records at all.

I know that the database connection has been established because there is no error but I can not see why the result set is not being displayed on screen, as I said it worked fine on my windows machine.

The Mac has mysql (with data) and apache running for php.

Please could someone help as I have no idea what to do now?

Script below:

$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = 'root';

$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');

$dbname = 'test';

mysql_select_db($dbname);

mysql_select_db("test", $conn);

$result = mysql_query("SELECT * FROM new_table");

while($row = mysql_fetch_array($result))
  {
  echo $row['test1'] . " " . $row['test2'] . " " . $row['test3'];
  echo "<br />";
  }

mysql_close($con);
  • 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-31T17:36:01+00:00Added an answer on May 31, 2026 at 5:36 pm

    Its very difficult to see what is wrong … so add some basic error checking, like changing this

    $result = mysql_query("SELECT * FROM new_table");
    

    to

    $result = mysql_query("SELECT * FROM new_table") or die(mysql_error());
    

    This will show you the error you are getting from your query (if there is one) .. you ill see in the documentation for mysql_query that it returns a boolean if there was an error

    Also note that you have a mistake in the variable name for closing the MySQL Connection :

    mysql_close($con);
    

    should be

    mysql_close($conn);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a php script to import rss feed into the database. The
I have created a script in which a i have to create a image
I just downloaded the mysql-proxy and created this script lua (found in Mysql docs):
I have created a VBS script in Windows. I will run this script to
I've created a script that uses psexec to call another script which calls psexec
I've created a windows service to start a .py script. sc create Maraschino binPath=
I am looking to create a Windows batch script to move about 2,000 files
When I try to create a COM object in VB script on a Windows
Using Windows 2003, I'm look for a way to create a logoff script that
I have created script to find selectivity of each columns for every tables. In

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.