daily pastebin goal
44%
SHARE
TWEET

Untitled

a guest Jun 5th, 2017 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function sql($query, $debug = 0){
  2.     global $LASTINSERTID;
  3.     if (LOCAL) {
  4.         $dbserver = 'localhost';
  5.         $dbuser = 'root';
  6.         $dbname = 'administration';
  7.         $dbpassword = '';
  8.     } else {
  9.         $dbserver = 'xxx';
  10.         $dbuser = 'xxx';
  11.         $dbname = 'xxx';
  12.         $dbpassword = 'xxx';
  13.     }
  14.  
  15.     if ($debug) {
  16.         echo '<pre class="debug" style="font: normal normal 10pt \'Courier New\'">';
  17.         echo $query;
  18.         echo '</pre>';
  19.     }
  20.  
  21.     $connect = mysql_connect($dbserver, $dbuser, $dbpassword);
  22.     mysql_select_db($dbname, $connect);
  23.     mysql_query('SET NAMES \'utf-8\'');
  24.     mysql_query('SET character_set_client=utf8');
  25.     mysql_query('SET character_set_connection=utf8');
  26.     mysql_query('SET character_set_results=utf8');
  27.     $res = mysql_query($query);
  28.     if(mysql_errno()) die(mysql_errno() .' : '. mysql_error());
  29.     if(mysql_insert_id()){
  30.         $LASTINSERTID = mysql_insert_id();
  31.     }
  32.  
  33.     mysql_close($connect);
  34.     return $res;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top