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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:40:18+00:00 2026-06-03T15:40:18+00:00

Output: Warning: mysql_query(): 6 is not a valid MySQL-Link resource in C:…\mysql_helper.php on line

  • 0

Output:

Warning: mysql_query(): 6 is not a valid MySQL-Link resource in C:…\mysql_helper.php on line 94

$con = mysql_connect($GLOBALS['mysql_host'], $GLOBALS['mysql_username'], $GLOBALS['mysql_password']) or die(mysql_error());
$db = mysql_select_db($GLOBALS['mysql_database']) or die(mysql_error($con));


$username=sanitize_mysql($username);
$password=sanitize_mysql($password);
$email=sanitize_mysql($email);

if(check_exists("users", "username", $username) == FALSE){ 
    $query = "INSERT INTO users VALUES('".$username."','".$password."','".$email."','".$status."','".$reg_date."','".$own_ref_id."','')";
    $result = mysql_query($query,$con) or die(mysql_error($con));
    return TRUE;
} else {
    return FALSE;
}
mysql_close($con);

Works in every other function built like this (copy/paste)

This is check_exists

    function check_exists($table,$specifier,$value)
{
    $con = mysql_connect($GLOBALS['mysql_host'], $GLOBALS['mysql_username'], $GLOBALS['mysql_password']) or die(mysql_error());
    $db = mysql_select_db($GLOBALS['mysql_database']) or die(mysql_error($con));


    $query = "SELECT * FROM ".$table." WHERE ".$specifier." = '".$value."'";
    $erg = mysql_query($query) or die(mysql_error());

    while ($row = mysql_fetch_array($erg)) {
        mysql_close($con);
        return TRUE;
    }
    mysql_close($con);
    return FALSE;
}
  • 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-06-03T15:40:24+00:00Added an answer on June 3, 2026 at 3:40 pm

    It appears that the $con in check_exists() is in the same scope as your $con and, therefore, check_exists() first overrides (and loses) your original connection then subsequently closes its own connection when it calls mysql_close($con).

    You would be better to maintain a single connection that is left open for the use of all such functions.

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

Sidebar

Related Questions

Error: Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 3: parser error : Input is not proper
Warning: Cannot modify header information - headers already sent by (output started at /home/blocexco/public_html/homepage.php:73)
Is there a way to enable a hilighting scheme for gcc/g++ warning output? I'd
Warning (2): Cannot modify header information - headers already sent by (output started at
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/storeadmin/inventory_list.php:68)
I'm getting this warning in my Output window (which doesn't affect functionality but I
I have this warning every time I run my CGI-script (output is rendered by
I know it is not a good idea to store images in mysql database
Warning: very outdated question with an awful idea. Storing code, whether it be PHP,
I have a number of command line scripts in PHP that use exec() to

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.