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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:59:56+00:00 2026-05-28T05:59:56+00:00

When i shifted my working code from local to my dedicated host, none of

  • 0

When i shifted my working code from local to my dedicated host, none of the query is working, however I am able to connect to the database. I know it should be something trivial but i am unable to work it out since last hour.

Here is my code:

<?php 
set_time_limit(0);
$DbCon =  mysql_connect('localhost:1023','username','password');
mysql_select_db('dbname', $DbCon);
if (!$DbCon)
{
die('Could not connect: ' . mysql_error());
}
else
{
echo("wait...\n");
    echo("Caching name...\n");
$query0="SELECT * FROM sometablename2";
$Result0 = mysql_query($query0,$DbCon);
$anarray=array();
    $anotherarray=array();
while($records0 = mysql_fetch_array($Result0))
{
        do something
}

}

The Output i get is :
wait…
Caching name…
PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /path/to/php/file/code.php on line 42
PHP Warning: mysql_free_result() expects parameter 1 to be resource, boolean given in /path/to/php/file/code.php on line 56

So, it’s clear that I am able to connect to database but no output from this query. I have run the same query in the database and it is working.
Any directions will be very helpful.

  • 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-28T05:59:57+00:00Added an answer on May 28, 2026 at 5:59 am

    Use the mysql_error function to find out what’s wrong.

    mysql_query("SELECT * FROM nonexistenttable", $link);
    echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
    

    Edit: as per comment below, also try, for example:

    // make foo the current db
    $db_selected = mysql_select_db('foo', $link);
    if (!$db_selected) {
        die ('Can\'t use foo : ' . mysql_error());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this should be very simple especially given all the information and example
I would like to plot the shifted logistic function as shown from Wolfram Alpha
I have recently shifted to OSX environment, so don't know much about MacPorts. Is
I'm working on a c++ project that reads MIDI-data from an external USB-device. The
i have just shifted from L2S to EF 4. In L2S, I heavily used
I have some C code, where an unsigned integer is shifted by a (signed)
I've been working on a C-like grammar for my personal amusement. However, I've been
I've been working on some sound processing code and now I'm doing some visualizations.
I have a query that fetches employee's name, date, working hours, wage and calculate
I recently shifted from JAVA development environment to .net development environment. I am developing

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.