title: g: mysql_query(): supplied argument is not a valid MySQL-Link resource
body: <p>Here is my connect.php</p>
  
  <pre><code>    class DB_class {
      protected function dblogin() {
      if(!defined('DB_CONNECTED')) {
  
        $DB = 'mydb';
          $USER='myuser';
          $PASS='mypass';
  
        $HOST='localhost';
        //$link = @mysql_pconnect($HOST,$USER,$PASS) or die("DB connect error");
          $link=@mysql_connect($HOST,$USER,$PASS) or die("DB connect error");
          mysql_select_db($DB, $link);
          mysql_query("SET NAMES 'utf8'");
          return $link;
          }
      }
      function dbclose() {
          mysql_close();
      }
  
      function dbfree($result) {
          mysql_free_result($result);
      }
  }
  </code></pre>
  
  <p>and here is my insert.php code</p>
  
  <pre><code>require('connect.php');
  $name = $_POST['FIRSTNAME'];
  $name2 = $_POST['SURNAME'];
  $email = $_POST['EMAIL'];
  $phone = $_POST['PHONE'];
  $mailing_list = $_POST['MAILING_LIST'];
  $enquiryMessage = $_POST['MESSAGE'];
  
  $DB = new DB_class();
  $link = $DB-&gt;dblogin();
  
  
  $sql = "INSERT INTO user (DATE_REG, FIRSTNAME, SURNAME, NICK, EMAIL, ACCESS,user.GROUP  ,MAILING_LIST)
  VALUES ('".date('Y-m-d H:i:s')."', '$name', '$name2', '$email', '$email', 0, 4, '$mailing_list')";
  
  // $query  = mysql_query($conn, $sql, MYSQLI_USE_RESULT);
  
  var_dump(mysql_query($sql,$link));
  </code></pre>
  
  <p>I'm getting error "g: mysql_query(): supplied argument is not a valid MySQL-Link resource".
  Thanks for help in advance.</p>