title: Incorrect integer value: '' for column 'id'
body: <p>I made a profile page for users, but I am getting this error: </p>
  
  <blockquote>
    <p>Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'id' at row 1 in C:\wamp64\www\social_network\classes\DB.php on line 12
    ( ! ) PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'id' at row 1 in C:\wamp64\www\social_network\classes\DB.php on line 12</p>
  </blockquote>
  
  <p>I am sure that my <code>\classes\DB.php</code> is correct, because it is connected to other php files. This is the "profile page" code that I am using:</p>
  
  <p>Thank you for your time.</p>
  
  <pre><code>Call Stack
  #   Time    Memory  Function    Location
  1   0.0009  391176  {main}( )   ...\profile.php:0
  2   0.0329  444848  Post::createPost( ) ...\profile.php:62
  3   0.0330  445224  DB::query( )    ...\Post.php:25
  4   0.0349  461048  execute ( ) ...\DB.php:12
  
  &lt;?php
  include('./classes/DB.php');
  include('./classes/Login.php');
  include('./classes/Post.php');
  include('./classes/Image.php');
  
  $username = "";
  $verified = False;
  $isFollowing = False;
  if (isset($_GET['username'])) {
          if (DB::query('SELECT username FROM users WHERE username=:username', array(':username'=&gt;$_GET['username']))) {
  
                  $username = DB::query('SELECT username FROM users WHERE username=:username', array(':username'=&gt;$_GET['username']))[0]['username'];
                  $userid = DB::query('SELECT id FROM users WHERE username=:username', array(':username'=&gt;$_GET['username']))[0]['id'];
                  $verified = DB::query('SELECT verified FROM users WHERE username=:username', array(':username'=&gt;$_GET['username']))[0]['verified'];
                  $followerid = Login::isLoggedIn();
  
                  if (isset($_POST['follow'])) {
  
                          if ($userid != $followerid) {
  
                                  if (!DB::query('SELECT follower_id FROM followers WHERE user_id=:userid AND follower_id=:followerid', array(':userid'=&gt;$userid, ':followerid'=&gt;$followerid))) {
                                          if ($followerid == 6) {
                                                  DB::query('UPDATE users SET verified=1 WHERE id=:userid', array(':userid'=&gt;$userid));
                                          }
                                          DB::query('INSERT INTO followers VALUES (null, :userid, :followerid)', array(':userid'=&gt;$userid, ':followerid'=&gt;$followerid));
                                  } else {
                                          echo 'Already following!';
                                  }
                                  $isFollowing = True;
                          }
                  }
                  if (isset($_POST['unfollow'])) {
  
                          if ($userid != $followerid) {
  
                                  if (DB::query('SELECT follower_id FROM followers WHERE user_id=:userid AND follower_id=:followerid', array(':userid'=&gt;$userid, ':followerid'=&gt;$followerid))) {
                                          if ($followerid == 6) {
                                                  DB::query('UPDATE users SET verified=0 WHERE id=:userid', array(':userid'=&gt;$userid));
                                          }
                                          DB::query('DELETE FROM followers WHERE user_id=:userid AND follower_id=:followerid', array(':userid'=&gt;$userid, ':followerid'=&gt;$followerid));
                                  }
                                  $isFollowing = False;
                          }
                  }
                  if (DB::query('SELECT follower_id FROM followers WHERE user_id=:userid AND follower_id=:followerid', array(':userid'=&gt;$userid, ':followerid'=&gt;$followerid))) {
                          //echo 'Already following!';
                          $isFollowing = True;
                  }
  
                  if (isset($_POST['deletepost'])) {
                          if (DB::query('SELECT id FROM posts WHERE id=:postid AND user_id=:userid', array(':postid'=&gt;$_GET['postid'], ':userid'=&gt;$followerid))) {
                                  DB::query('DELETE FROM posts WHERE id=:postid and user_id=:userid', array(':postid'=&gt;$_GET['postid'], ':userid'=&gt;$followerid));
                                  DB::query('DELETE FROM post_likes WHERE post_id=:postid', array(':postid'=&gt;$_GET['postid']));
                                  echo 'Post deleted!';
                          }
                  }
  
  
                  if (isset($_POST['post'])) {
                          if ($_FILES['postimg']['size'] == 0) {
                                  Post::createPost($_POST['postbody'], Login::isLoggedIn(), $userid);
                          } else {
                                  $postid = Post::createImgPost($_POST['postbody'], Login::isLoggedIn(), $userid);
                                  Image::uploadImage('postimg', "UPDATE posts SET postimg=:postimg WHERE id=:postid", array(':postid'=&gt;$postid));
                          }
                  }
  
                  if (isset($_GET['postid']) &amp;&amp; !isset($_POST['deletepost'])) {
                          Post::likePost($_GET['postid'], $followerid);
                  }
  
                  $posts = Post::displayPosts($userid, $username, $followerid);
  
  
          } else {
                  die('User not found!');
          }
  }
  
  ?&gt;
  &lt;h1&gt;&lt;?php echo $username; ?&gt;'s Profile&lt;?php if ($verified) { echo ' - Verified'; } ?&gt;&lt;/h1&gt;
  &lt;form action="profile.php?username=&lt;?php echo $username; ?&gt;" method="post"&gt;
          &lt;?php
          if ($userid != $followerid) {
                  if ($isFollowing) {
                          echo '&lt;input type="submit" name="unfollow" value="Unfollow"&gt;';
                  } else {
                          echo '&lt;input type="submit" name="follow" value="Follow"&gt;';
                  }
          }
          ?&gt;
  &lt;/form&gt;
  
  &lt;form action="profile.php?username=&lt;?php echo $username; ?&gt;" method="post" enctype="multipart/form-data"&gt;
          &lt;textarea name="postbody" rows="8" cols="80"&gt;&lt;/textarea&gt;
          &lt;br /&gt;Upload an image:
          &lt;input type="file" name="postimg"&gt;
          &lt;input type="submit" name="post" value="Post"&gt;
  &lt;/form&gt;
  
  &lt;div class="posts"&gt;
          &lt;?php echo $posts; ?&gt;
  &lt;/div&gt;
  </code></pre>