Pastebin

Paste #227:

< previous paste - next paste>

Pasted by Anonymous Coward

Download View as text

     61 function prepare_statement () {
     62
     63   // Get all args
     64   $args = func_get_args();
     65
     66   // Seperate first arg
     67   $query = array_shift($args);
     68
     69   // Process args
     70   foreach( $args as $k => $v ) {
     71     if( $v != NULL ) {
     72       if ( get_magic_quotes_gpc() ) {
     73         $v = stripslashes($v);
     74       }
     75       $args[$k]="'".mysql_escape_string($v)."'";
     76     } else {
     77       $args[$k]="NULL";
     78     }
     79   }
     80   $query = vsprintf($query, $args);
     81   logsql($query);
     82   return $query;
     83 }
     84
     85 function exec_statement($statement) {
     86   $result =  mysql_query($statement);
     87   if(!$result) die(logerror("MySQL error: ".mysql_error() ) );
     88   return $result;
     89 }

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.