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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T22:54:12+00:00 2026-05-28T22:54:12+00:00

Few days back i suddenly came up with getting empty result, I was surprised

  • 0

Few days back i suddenly came up with getting empty result, I was surprised and then check out the mysql_error function and then got this 2006: Mysql server has gone away. The problem is that it doesn’t comes everytime, but sometimes only for the same query.

I have checked out many questions here at stackoverflow as well as many blogs on the web, but I found no possible solution for this error

Today, I wrote this function for that and the error gones away,

$conn = mysql_connect($this->host, $this->dbUser, $this->dbPass);
    $db_select = mysql_select_db($this->dbName, $conn);

    for($i=0;mysql_error($conn) != 2006;$i++)
    {
        $result = mysql_query($sql, $conn);
        if($i > 10){break;}
    }

I wanna ask the professionals that if it it is the proper way of getting rid of this kinda situation or it is the wrong method for that

  • 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-28T22:54:12+00:00Added an answer on May 28, 2026 at 10:54 pm

    This error will occurr when the MySQL server has been restarted / unavailable. It could be happening on a specific query if the query is causing some kind of problem (can’t say more without knowing what the query does).

    Either way, this error is valid and shouldn’t be ignored. You need to find out WHY it is being raised in the first place.

    You can use the mysql_ping function to check if the server is available before running a query rather than catching the error.

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

Sidebar

Related Questions

I came across a competitor product to VisualSVN a few days back. It provides
I started reading about implementing various data structures a few days back, and got
Few days back, I posted a question about getting student marks results from database
I got acquainted with jQuery a few days back and am beginning to realize
A few days back, while the built-in server (Tomcat v5.5) in eclipse was running,
I remember seeing the code for a Highpass filter a few days back somewhere
A few days back I felt this question to be dumb and dint post
I bought a VPS a few days back and had a domain name registered.
A few days back, I started using new OpenCV-Python interface, cv2 . My question
A few days back there was a discussion here about whether the expression i

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.