Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include '../conn/conn.php;
- function select($sql, $param = array(), $fetchMode = PDO::FETCH_ASSOC){
- global $koneksi;
- $stmt = $koneksi->prepare($sql);
- foreach($param as $key => $value){
- if(is_int($value)){
- $stmt->bindValue("$key", $value, PDO::PARAM_INT);
- } else {
- $stmt->bindValue("$key", $value);
- }
- }
- $stmt->execute();
- return $stmt->fetchAll($fetchMode);
- }
- // cara penerapan
- session_start();
- $user = $_POST['user'];
- $pass = md5($_POST['pass']);
- $view = select("select * from user where username= :username", array(':username' => $user));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement