1
SELECT * FROM user_info LEFT JOiN general_information ON user_info.username = general_information.vendor_id LEFT JOIN company_information ON user_info.username = company_information.vendor_id LEFT JOIN usa_on_shore_site_locations ON user_info.username = usa_on_shore_site_locations.vendor_id LEFT JOIN core_competencies ON user_info.username = core_competencies.vendor_id LEFT JOIN industries_served ON user_info.username = industries_served.vendor_id LEFT JOIN vendor_level ON user_info.username = vendor_level.vendor_id LEFT JOIN nearshore_and_offshore_locations ON user_info.username = nearshore_and_offshore_locations.vendor_id LEFT JOIN languages ON user_info.username = languages.vendor_id LEFT JOIN services ON user_info.username = services.vendor_id LEFT JOIN remote_work_at_home_virtual_agents ON user_info.username = remote_work_at_home_virtual_agents.vendor_id LEFT JOIN remote_work_at_home_virtual_agents_countries ON user_info.username = remote_work_at_home_virtual_agents_countries.vendor_id LEFT JOIN technology ON user_info.username = technology.vendor_id LEFT JOIN certifications_compliance ON user_info.username = certifications_compliance.vendor_id LEFT JOIN business_mix ON user_info.username = business_mix.vendor_id WHERE general_information.street_address LIKE '%%' AND (languages.languages = 'Amharic' OR languages.all_languages = 'all' ) GROUP BY user_info.username

How can i make my query to be not lost connection when query

pkc456
  • 8,350
  • 38
  • 53
  • 109

1 Answers1

1

You have to use mysql_ping().

As Per PHP Documentation :

Checks whether the connection to the server is working. If the connection has gone down and auto-reconnect is enabled an attempt to reconnect is made. If the connection is down and auto-reconnect is disabled, mysql_ping() returns an error.

Your Solution :

$query = "SELECT * FROM user_info LEFT JOiN general_information ON user_info.username = general_information.vendor_id LEFT JOIN company_information ON user_info.username = company_information.vendor_id LEFT JOIN usa_on_shore_site_locations ON user_info.username = usa_on_shore_site_locations.vendor_id LEFT JOIN core_competencies ON user_info.username = core_competencies.vendor_id LEFT JOIN industries_served ON user_info.username = industries_served.vendor_id LEFT JOIN vendor_level ON user_info.username = vendor_level.vendor_id LEFT JOIN nearshore_and_offshore_locations ON user_info.username = nearshore_and_offshore_locations.vendor_id LEFT JOIN languages ON user_info.username = languages.vendor_id LEFT JOIN services ON user_info.username = services.vendor_id LEFT JOIN remote_work_at_home_virtual_agents ON user_info.username = remote_work_at_home_virtual_agents.vendor_id LEFT JOIN remote_work_at_home_virtual_agents_countries ON user_info.username = remote_work_at_home_virtual_agents_countries.vendor_id LEFT JOIN technology ON user_info.username = technology.vendor_id LEFT JOIN certifications_compliance ON user_info.username = certifications_compliance.vendor_id LEFT JOIN business_mix ON user_info.username = business_mix.vendor_id WHERE general_information.street_address LIKE '%%' AND (languages.languages = 'Amharic' OR languages.all_languages = 'all' ) GROUP BY user_info.username"
while(!mysql_ping($connection)) {
    sleep(5);
}
mysql_query($query) or die(mysql_error());
LuFFy
  • 8,799
  • 10
  • 41
  • 59