PHP DB Programming

PHP DB Code

mysqli
$mysqli = new mysqli('localhost', 'username', 'password', 'my_db');

   if(mysqli_connect_errno()) {
      echo mysqli_connect_errno();
      exit();
   }

   if ($stmt = $mysqli->prepare("SELECT real_name, id FROM app_users WHERE uname=? AND uid=?")) {

      # Bind parameters: s: string, i: int
      $stmt->bind_param("si", $user, $user_id);

      $stmt->execute();

      $stmt->bind_result($rname, $rid);

      while ($stmt->fetch()) {
        echo $rname, $rid;
      }

      $stmt->close();
   }

   $mysqli->close();
symbol Column type
i All int type
d Double/float
b BLOBs
s String