Advertisement
Isaac18

helper

Dec 18th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. <?Php
  2.  
  3. function userid($id){
  4.     try{
  5.         include 'dbcon.php';
  6.        
  7.         $sql = 'SELECT * FROM users where id = :id';
  8.         $s = $pdo->prepare($sql);
  9.         $s->bindValue(':id', $id);
  10.         $s->execute();
  11.     }catch (PDOException $e){
  12.         $error = 'Error fetching id: ' . $e->getMessage();
  13.         include 'error.php';
  14.         exit();
  15.     }
  16.     $id = $s->fetch();
  17.     return $id[0];
  18. }
  19.  
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement