Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function query($sql) {
- $dbc = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME, DB_USER, DB_PASS);
- $dbc->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
- $args = func_get_args();
- $sta = $dbc->prepare($sql);
- array_shift($args);
- while(!empty($args)) {
- foreach($args as $key => $value) {
- $sta->bindParam(++$key, $value);
- }
- }
- $result = $sta->execute();
- $dbc = null;
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement