Guest User

Untitled

a guest
Jan 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. $db_con = @new mysqli( 'localhost', 'root', '', 'ImgBox_db' );
  2. $user_id = $_SESSION['user_id'];
  3. $user_content_id = "SELECT COUNT(user_id) FROM content WHERE user_id = '$user_id'";
  4. $count = mysqli_query( $db_con, $user_content_id );
  5.  
  6. $count=$dbh->query("SELECT COUNT(user_id) FROM content WHERE user_id = '$user_id'")->fetchColumn();
  7.  
  8. public function connectdb($db_name, $db_user, $db_pass, $db_host = "localhost")
  9. {
  10. try {
  11. $this->db = new pdo("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);
  12. } catch (pdoexception $e) {
  13. echo "database error: " . $e->getmessage();
  14. die();
  15. }
  16. $this->db->query('set names utf8');
  17.  
  18. return $this;
  19. }
Add Comment
Please, Sign In to add comment