title: how to add image path in mysql database?
body: <p>I am very new to PHP and I need your help.</p>
  
  <p>This is insert.php file that inserts all records.`` File browsing field is also added here. This field browse photo. Temp_File is stored in thumbnails folder. My Question is how to save the image path in MySQL database and how to retrieve this image from dB for displaying in view.php.</p>
  
  <p>//This is insert.php</p>
  
  <pre><code> {&lt;?php require_once('Connections/db_sms.php'); ?&gt;
      &lt;?php
      if (!isset($_SESSION)) {
        session_start();
      }
      $MM_authorizedUsers = "";
      $MM_donotCheckaccess = "true";
  
      // *** Restrict Access To Page: Grant or deny access to this page
      function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
        // For security, start by assuming the visitor is NOT authorized. 
        $isValid = False; 
  
        // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
        // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
        if (!empty($UserName)) { 
          // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
          // Parse the strings into arrays. 
          $arrUsers = Explode(",", $strUsers); 
          $arrGroups = Explode(",", $strGroups); 
          if (in_array($UserName, $arrUsers)) { 
            $isValid = true; 
          } 
          // Or, you may restrict access to only certain users based on their username. 
          if (in_array($UserGroup, $arrGroups)) { 
            $isValid = true; 
          } 
          if (($strUsers == "") &amp;&amp; true) { 
            $isValid = true; 
          } 
        } 
        return $isValid; 
      }
  
      $MM_restrictGoTo = "login.php";
      if (!((isset($_SESSION['MM_Username'])) &amp;&amp; (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
        $MM_qsChar = "?";
        $MM_referrer = $_SERVER['PHP_SELF'];
        if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&amp;";
        if (isset($_SERVER['QUERY_STRING']) &amp;&amp; strlen($_SERVER['QUERY_STRING']) &gt; 0) 
        $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
        $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
        header("Location: ". $MM_restrictGoTo); 
        exit;
      }
      ?&gt;
      &lt;?php
      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
      {
        if (PHP_VERSION &lt; 6) {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
  
        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
        switch ($theType) {
          case "text":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;    
          case "long":
          case "int":
            $theValue = ($theValue != "") ? intval($theValue) : "NULL";
            break;
          case "double":
            $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
            break;
          case "date":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;
          case "defined":
            $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
            break;
        }
        return $theValue;
      }
      }
  
      $editFormAction = $_SERVER['PHP_SELF'];
      if (isset($_SERVER['QUERY_STRING'])) {
        $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
      }
  
      if ((isset($_POST["MM_insert"])) &amp;&amp; ($_POST["MM_insert"] == "regform")) {
        $insertSQL = sprintf("INSERT INTO tbl_student (s_id, first_name, last_name, gender, dob, father_name, email, address, city) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)",
                             GetSQLValueString($_POST['student_photo'], "text"),
                             GetSQLValueString($_POST['first_name'], "text"),
                             GetSQLValueString($_POST['last_name'], "text"),
                             GetSQLValueString($_POST['gender'], "text"),
                             GetSQLValueString($_POST['dob'], "date"),
                             GetSQLValueString($_POST['father_name'], "text"),
                             GetSQLValueString($_POST['email'], "text"),
                             GetSQLValueString($_POST['address'], "text"),
                             GetSQLValueString($_POST['city'], "text"));
  
        mysql_select_db($database_db_sms, $db_sms);
        $Result1 = mysql_query($insertSQL, $db_sms) or die(mysql_error());
  
        $insertGoTo = "view.php";
        if (isset($_SERVER['QUERY_STRING'])) {
          $insertGoTo .= (strpos($insertGoTo, '?')) ? "&amp;" : "?";
          $insertGoTo .= $_SERVER['QUERY_STRING'];
        }
        header(sprintf("Location: %s", $insertGoTo));
      }
      ?&gt;
      &lt;?php require_once('Zend/Date.php'); ?&gt;
      &lt;?php $username = "root";
      $password = "";
      $host = "localhost";
      $database = "db_sms";
  
      // Make the connect to MySQL or die
      // and display an error.
      $link = mysql_connect($host, $username, $password);
      if (!$link) {
              die('Could not connect: ' . mysql_error());
      }
  
      // Select your database
      mysql_select_db ($database);?&gt;
  
  
      &lt;?php if (isset($_FILES['student_photo']) &amp;&amp; $_FILES['student_photo']['size'] &gt; 0) { 
  
                // Temporary file name stored on the server
                $tmpName  = $_FILES['student_photo']['tmp_name'];  
                // Create the query and insert
                // into our database.
                $i=rand(0,8888);
                 $info=pathinfo($_FILES['student_photo']['name']);
                  $ext=$info['extension'];
                  $i++;
                  $newname="pic_".$i.".".$ext;
                  $target='thumbnails/'.$newname;
                move_uploaded_file($_FILES['student_photo']['tmp_name'], $target );
                $query = "INSERT INTO tbl_students ";
                $query .= "(student_photo) VALUES ('$data')";
                $results = mysql_query($query, $link);
  
                // Print results
                print "Thank you, your file has been uploaded.";
  
      }
      else {
         print "No image selected/uploaded";
      }
  
  
      mysql_close($link);
      ?&gt;
  
  
      &lt;?php
      if (!function_exists("GetSQLValueString")) {
      function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  
  
  
  
        if (PHP_VERSION &lt; 6) {
          $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
        }
  
        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
        switch ($theType) {
          case "text":
            $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
            break;    
          case "long":
          case "int":
            $theValue = ($theValue != "") ? intval($theValue) : "NULL";
            break;
          case "double":
            $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
            break;
          case "date":
             if ($theValue == "")
            {
                $theValue = "NULL";
            }
            else
            {
                $zendDate = new Zend_Date($theValue, "d/M/yyyy");
                $theValue = "'" . $zendDate-&gt;toString("dd-MM-yyyy") . "'";
            }
            break;
          case "defined":
            $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
            break;
        }
        return $theValue;
      }
      }
  
      mysql_select_db($database_db_sms, $db_sms);
      $query_rsStudent = "SELECT s_id, first_name, last_name, gender, dob, father_name, email, address, city, student_photo FROM tbl_student ORDER BY first_name ASC";
      $rsStudent = mysql_query($query_rsStudent, $db_sms) or die(mysql_error());
      $row_rsStudent = mysql_fetch_assoc($rsStudent);
      $totalRows_rsStudent = mysql_num_rows($rsStudent);
  
      $query_rsStudent = "SELECT first_name, last_name, gender, dob, father_name, email, address, city FROM tbl_student ORDER BY first_name ASC";
      $rsStudent = mysql_query($query_rsStudent, $db_sms) or die(mysql_error());
      $row_rsStudent = mysql_fetch_assoc($rsStudent);
      $totalRows_rsStudent = mysql_num_rows($rsStudent);
      ?&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
      &lt;title&gt;Registration&lt;/title&gt;
  
      &lt;script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="SpryAssets/SpryValidationRadio.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" /&gt;
      &lt;style type="text/css"&gt;
      body,td,th {
          font-family: "Times New Roman", Times, serif;
          font-size: 18px;
          color: #FFFFFF;
      }
      body {
          background-color: #636;
          margin-left: 400px;
          margin-top: 100px;
          margin-right: 400px;
      }
      &lt;/style&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
      &lt;?php /* include('include/header.php');*/ ?&gt;
      &lt;form action="&lt;?php echo $editFormAction; ?&gt;" name="regform" id="regform" enctype="multipart/form-data" method="POST"&gt;
  
      &lt;table width="1495" border="0"&gt;
        &lt;tr&gt;
          &lt;td width="115"&gt;First Name&lt;/td&gt;
          &lt;td width="1370"&gt;&lt;span id="spryfirstname"&gt;
          &lt;input name="first_name" type="text"    maxlength="50" /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Last Name&lt;/td&gt;
          &lt;td&gt;&lt;span id="sprylastname"&gt;
          &lt;input name="last_name" type="text"    maxlength="50" /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Gender&lt;/td&gt;
          &lt;td&gt;&lt;label&gt;
          &lt;span id="spryrggender"&gt;
          &lt;input  type="radio" name="gender" value="Male" id="male" /&gt;
      Male&lt;br /&gt;
      &lt;input type="radio" name="gender" value="Female" id="female" /&gt;
      Female&lt;br /&gt;
      &lt;span class="radioRequiredMsg"&gt;Required.&lt;/span&gt;&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Date Of Birth&lt;/td&gt;
          &lt;td&gt;&lt;span id="sprydob"&gt;
          &lt;input name="dob" type="text"   /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;Date of Birth is required.&lt;/span&gt;&lt;span class="textfieldInvalidFormatMsg"&gt;Invalid format.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Father's Name&lt;/td&gt;
          &lt;td&gt;&lt;span id="spryfathername"&gt;
          &lt;input name="father_name" type="text"  maxlength="50" /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;E-mail Address&lt;/td&gt;
          &lt;td&gt;&lt;span id="spryemail"&gt;
          &lt;input name="email" type="text"   /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldInvalidFormatMsg"&gt;Invalid format.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Address&lt;/td&gt;
          &lt;td&gt;&lt;span id="spryaddress"&gt;
          &lt;input name="address" type="text"  /&gt;
          &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;City&lt;/td&gt;
          &lt;td&gt;&lt;span id="sprycity"&gt;
            &lt;input name="city" type="text"  /&gt;
            &lt;span class="textfieldRequiredMsg"&gt;A value is required.&lt;/span&gt;&lt;span class="textfieldMaxCharsMsg"&gt;Exceeded maximum number of characters.&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
          &lt;td&gt;Upload image&lt;/td&gt;
          &lt;td&gt;
            &lt;input type="file" name="student_photo" id="student_photo" /&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
        &lt;td&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input name="insert" type="submit" value="Insert Record" /&gt;&lt;/td&gt;
        &lt;/tr&gt;
  
      &lt;/table&gt;
      &lt;input type="hidden" name="MM_insert" value="regform" /&gt;
      &lt;/form&gt;
  
      &lt;p&gt;&amp;nbsp;&lt;/p&gt;
      &lt;script type="text/javascript"&gt;
      var sprytextfield1 = new Spry.Widget.ValidationTextField("spryfirstname", "none", {validateOn:["blur"], maxChars:50});
      var sprytextfield2 = new Spry.Widget.ValidationTextField("sprylastname", "none", {validateOn:["blur"], maxChars:50});
      var spryradio1 = new Spry.Widget.ValidationRadio("spryrggender", {validateOn:["blur"]});
      var sprytextfield3 = new Spry.Widget.ValidationTextField("sprydob", "date", {format:"dd/mm/yyyy", validateOn:["blur"], hint:"dd/mm/yyyy"});
      var sprytextfield4 = new Spry.Widget.ValidationTextField("spryfathername", "none", {validateOn:["blur"], maxChars:50});
      var sprytextfield5 = new Spry.Widget.ValidationTextField("spryemail", "email", {maxChars:50, validateOn:["blur"]});
      var sprytextfield6 = new Spry.Widget.ValidationTextField("spryaddress", "none", {maxChars:50, validateOn:["blur"]});
      var sprytextfield7 = new Spry.Widget.ValidationTextField("sprycity", "none", {maxChars:50, validateOn:["blur"]});
      var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8");
      &lt;/script&gt;
      &lt;/body&gt;
      &lt;/html&gt;
      &lt;?php
      mysql_free_result($rsStudent);
      ?&gt;
  
  ////////
  This is view.php file in which record is displayed
  ----
  
  
  &lt;?php require_once('Connections/db_sms.php'); ?&gt;
  &lt;?php
  if (!isset($_SESSION)) {
    session_start();
  }
  $MM_authorizedUsers = "";
  $MM_donotCheckaccess = "true";
  
  // *** Restrict Access To Page: Grant or deny access to this page
  function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) { 
    // For security, start by assuming the visitor is NOT authorized. 
    $isValid = False; 
  
    // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
    // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
    if (!empty($UserName)) { 
      // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
      // Parse the strings into arrays. 
      $arrUsers = Explode(",", $strUsers); 
      $arrGroups = Explode(",", $strGroups); 
      if (in_array($UserName, $arrUsers)) { 
        $isValid = true; 
      } 
      // Or, you may restrict access to only certain users based on their username. 
      if (in_array($UserGroup, $arrGroups)) { 
        $isValid = true; 
      } 
      if (($strUsers == "") &amp;&amp; true) { 
        $isValid = true; 
      } 
    } 
    return $isValid; 
  }
  
  $MM_restrictGoTo = "login.php";
  if (!((isset($_SESSION['MM_Username'])) &amp;&amp; (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
    $MM_qsChar = "?";
    $MM_referrer = $_SERVER['PHP_SELF'];
    if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&amp;";
    if (isset($_SERVER['QUERY_STRING']) &amp;&amp; strlen($_SERVER['QUERY_STRING']) &gt; 0) 
    $MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
    $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
    header("Location: ". $MM_restrictGoTo); 
    exit;
  }
  ?&gt;
  &lt;?php require_once('Zend/Date.php');?&gt;
  &lt;?php
  if (!function_exists("GetSQLValueString")) {
  function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  {
    if (PHP_VERSION &lt; 6) {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }
  
    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
    switch ($theType) {
      case "text":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;    
      case "long":
      case "int":
        $theValue = ($theValue != "") ? intval($theValue) : "NULL";
        break;
      case "double":
        $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
        break;
      case "date":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;
      case "defined":
        $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
        break;
    }
    return $theValue;
  }
  }
  
  $currentPage = $_SERVER["PHP_SELF"];
  
  
  
  $maxRows_rsStudent = 3;
  $pageNum_rsStudent = 0;
  if (isset($_GET['pageNum_rsStudent'])) {
    $pageNum_rsStudent = $_GET['pageNum_rsStudent'];
  }
  $startRow_rsStudent = $pageNum_rsStudent * $maxRows_rsStudent;
  
  mysql_select_db($database_db_sms, $db_sms);
  $query_rsStudent = "SELECT s_id, first_name, last_name, gender, dob, father_name, email, address, city, student_photo FROM tbl_student ORDER BY first_name ASC";
  $query_limit_rsStudent = sprintf("%s LIMIT %d, %d", $query_rsStudent, $startRow_rsStudent, $maxRows_rsStudent);
  $rsStudent = mysql_query($query_limit_rsStudent, $db_sms) or die(mysql_error());
  $row_rsStudent = mysql_fetch_assoc($rsStudent);
  
  if (isset($_GET['totalRows_rsStudent'])) {
    $totalRows_rsStudent = $_GET['totalRows_rsStudent'];
  } else {
    $all_rsStudent = mysql_query($query_rsStudent);
    $totalRows_rsStudent = mysql_num_rows($all_rsStudent);
  }
  $totalPages_rsStudent = ceil($totalRows_rsStudent/$maxRows_rsStudent)-1;
  
  $queryString_rsStudent = "";
  if (!empty($_SERVER['QUERY_STRING'])) {
    $params = explode("&amp;", $_SERVER['QUERY_STRING']);
    $newParams = array();
    foreach ($params as $param) {
      if (stristr($param, "pageNum_rsStudent") == false &amp;&amp; 
          stristr($param, "totalRows_rsStudent") == false) {
        array_push($newParams, $param);
      }
    }
    if (count($newParams) != 0) {
      $queryString_rsStudent = "&amp;" . htmlentities(implode("&amp;", $newParams));
    }
  }
  $queryString_rsStudent = sprintf("&amp;totalRows_rsStudent=%d%s", $totalRows_rsStudent, $queryString_rsStudent);
  ?&gt;
  
  &lt;?php
  
  
  if (!function_exists("GetSQLValueString")) {
  function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
  {
    if (PHP_VERSION &lt; 6) {
      $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
    }
  
    $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  
    switch ($theType) {
      case "text":
        $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
        break;    
      case "long":
      case "int":
        $theValue = ($theValue != "") ? intval($theValue) : "NULL";
        break;
      case "double":
        $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
        break;
      case "date":
         if ($theValue == "")
        {
            $theValue = "NULL";
        }
        else
        {
            $zendDate = new Zend_Date($theValue, "M/d/yyyy");
            $theValue = "'" . $zendDate-&gt;toString("yyyy-MM-dd") . "'";
        }
          break;
  
      case "defined":
        $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
        break;
    }
    return $theValue;
  }
  }
  ?&gt;
  &lt;style type="text/css"&gt;
  body,td,th {
      color: #000;
      font-family: "Courier New", Courier, monospace;
      font-size: 18px;
  }
  body {
      background-color: #FFF;
  }
  a:link {
      text-decoration: none;
  }
  a:visited {
      text-decoration: none;
      color: #606;
  }
  a:hover {
      text-decoration: underline;
      color: #066;
  }
  a:active {
      text-decoration: none;
      color: #600;
  }
  &lt;/style&gt;
  
  &lt;body bgcolor="#D6D6D6" text="#FFFFFF" link="#330000" vlink="#006666" alink="#660000"&gt;&lt;h1&gt;
    &lt;style type="text/css"&gt;
  #header {
      font-family: "Times New Roman", Times, serif;
      font-size: 24px;
      font-style: normal;
      line-height: normal;
      font-weight: normal;
      text-transform: none;
      color: #066;
      background-color: #FFF;
      background-image: url(../images/contest.jpg);
      background-repeat: no-repeat;
      background-size: auto;
      box-sizing: content-box;
      margin-bottom: 400px;
  }
  body,td,th {
      font-family: "Courier New", Courier, monospace;
      color: #000;
  }
  body {
      background-color: #FFF;
  }
    &lt;/style&gt;
  &lt;/h1&gt;
   &lt;?php /* include('include/header.php');*/?&gt; 
  
  &lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
  &lt;h3&gt;There are &lt;?php echo $totalRows_rsStudent ?&gt; Students.&lt;/h3&gt;
  &lt;p&gt;&amp;nbsp;
    &lt;?php if ($pageNum_rsStudent &gt; 0) { // Show if not first page ?&gt;
      &lt;a href="&lt;?php printf("%s?pageNum_rsStudent=%d%s", $currentPage, 0, $queryString_rsStudent); ?&gt;"&gt;First&lt;/a&gt; &lt;a href="&lt;?php printf("%s?pageNum_rsStudent=%d%s", $currentPage, max(0, $pageNum_rsStudent - 1), $queryString_rsStudent); ?&gt;"&gt;Previous&lt;/a&gt;
      &lt;?php } // Show if not first page ?&gt;
    &lt;?php if ($pageNum_rsStudent &lt; $totalPages_rsStudent) { // Show if not last page ?&gt;
    &lt;a href="&lt;?php printf("%s?pageNum_rsStudent=%d%s", $currentPage, min($totalPages_rsStudent, $pageNum_rsStudent + 1), $queryString_rsStudent); ?&gt;"&gt;Next&lt;/a&gt; &lt;a href="&lt;?php printf("%s?pageNum_rsStudent=%d%s", $currentPage, $totalPages_rsStudent, $queryString_rsStudent); ?&gt;"&gt;Last&lt;/a&gt;
    &lt;?php } // Show if not last page ?&gt;
  &lt;/p&gt;
  &lt;table width="400" border="0"&gt;
  
  &lt;/table&gt;
  &lt;form id="form1" name="form1" method="post" action="" enctype="multipart/form-data"&gt;
  &lt;table width="2139" border="0"&gt;
  
      &lt;tr&gt;
        &lt;th width="326" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;First Name&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="315" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;Last Name&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="282" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;Gender&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="183" bgcolor="#009999" scope="col"&gt;&lt;blockquote&gt;
          &lt;p&gt; &lt;strong&gt;BirthDate&lt;/strong&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/th&gt;
        &lt;th width="337" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;Father's Name&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="271" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;Email&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="95" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;Address&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="150" bgcolor="#009999" scope="col"&gt;&lt;strong&gt;City&lt;/strong&gt;&lt;/th&gt;
        &lt;th width="150" bgcolor="#009999" scope="col"&gt;&lt;blockquote&gt;
          &lt;p&gt;Photo&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/th&gt;
        &lt;th width="150" bgcolor="#009999" scope="col"&gt;&amp;nbsp;&lt;/th&gt;
        &lt;th width="7" bgcolor="#009999" scope="col"&gt;&amp;nbsp;&lt;/th&gt;
        &lt;th width="131" scope="col"&gt;&amp;nbsp;&lt;/th&gt;
      &lt;/tr&gt;
       &lt;?php do { ?&gt;
     &lt;?php 
              $zendDate = new Zend_Date($row_rsStudent['dob']);
            ?&gt;
  
      &lt;tr&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;a href="update.php?s_id=&lt;?php echo $row_rsStudent['s_id']; ?&gt;"&gt;&lt;?php echo $row_rsStudent['first_name']; ?&gt;&lt;/a&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;?php echo $row_rsStudent['last_name']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;?php echo $row_rsStudent['gender']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt; 
            &lt;?php echo $zendDate-&gt;toString("d/M/yyyy"); ?&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;?php echo $row_rsStudent['father_name']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;?php echo $row_rsStudent['email']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
  
  
  
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href="delete.php?s_id=&lt;?php echo $row_rsStudent['s_id']; ?&gt;"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;?php echo $row_rsStudent['address']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href="delete.php?s_id=&lt;?php echo $row_rsStudent['s_id']; ?&gt;"&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;?php echo $row_rsStudent['city']; ?&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#333333"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;img src="&lt;?php echo "thumbnails/".$row_rsStudent['student_photo']; ?&gt;"/&gt; &lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
        &lt;td bgcolor="#FFFFFF"&gt;&lt;blockquote&gt;
          &lt;p&gt;&lt;em&gt;&lt;strong&gt;&lt;a href="delete.php?s_id=&lt;?php echo $row_rsStudent['s_id']; ?&gt;"&gt;Delete&lt;/a&gt;&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
        &lt;/blockquote&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;?php } while ($row_rsStudent = mysql_fetch_assoc($rsStudent)); ?&gt;
    &lt;/table&gt;
    &lt;p&gt;&lt;strong&gt;&lt;a href="insert.php"&gt;Insert New Record&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
  &lt;/form&gt;
  &lt;?php
  mysql_free_result($rsStudent);
  ?&gt;
  </code></pre>
  
  <p>/////
  This is my db_sms connectiion file</p>
  
  <pre><code>&lt;?php
  # FileName="Connection_php_mysql.htm"
  # Type="MYSQL"
  # HTTP="true"
  $hostname_db_sms = "localhost";
  $database_db_sms = "db_sms";
  $username_db_sms = "root";
  $password_db_sms = "";
  $db_sms = mysql_pconnect($hostname_db_sms, $username_db_sms, $password_db_sms) or trigger_error(mysql_error(),E_USER_ERROR); 
  ?&gt;
  </code></pre>
  
  <p>//////
  This is mysql database file db_dms.sql</p>
  
  <p>-- </p>
  
  <pre><code>phpMyAdmin SQL Dump
  -- version 3.2.0.1
  -- http://www.phpmyadmin.net
  --
  -- Host: localhost
  -- Generation Time: Dec 06, 2012 at 05:07 AM
  -- Server version: 5.1.36
  -- PHP Version: 5.3.0
  
  SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
  
  --
  -- Database: `db_sms`
  --
  CREATE DATABASE `db_sms` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
  USE `db_sms`;
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `tbl_admin`
  --
  
  CREATE TABLE IF NOT EXISTS `tbl_admin` (
    `admin_id` int(11) NOT NULL AUTO_INCREMENT,
    `username` varchar(50) NOT NULL,
    `password` varchar(50) NOT NULL,
    PRIMARY KEY (`admin_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
  
  --
  -- Dumping data for table `tbl_admin`
  --
  
  INSERT INTO `tbl_admin` (`admin_id`, `username`, `password`) VALUES
  (1, 'root', 'root');
  
  -- --------------------------------------------------------
  
  --
  -- Table structure for table `tbl_student`
  --
  
  CREATE TABLE IF NOT EXISTS `tbl_student` (
    `s_id` int(11) NOT NULL AUTO_INCREMENT,
    `first_name` varchar(50) NOT NULL,
    `last_name` varchar(50) NOT NULL,
    `gender` varchar(50) NOT NULL,
    `dob` date NOT NULL,
    `father_name` varchar(50) NOT NULL,
    `email` varchar(50) NOT NULL,
    `address` varchar(50) NOT NULL,
    `city` varchar(50) NOT NULL,
    `student_photo` varchar(255) NOT NULL,
    PRIMARY KEY (`s_id`)
  ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=18 ;
  
  --
  -- Dumping data for table `tbl_student`
  --
  
  INSERT INTO `tbl_student` (`s_id`, `first_name`, `last_name`, `gender`, `dob`, `father_name`, `email`, `address`, `city`, `student_photo`) VALUES
  (3, 'Zara', 'Mansoor', 'Female', '0000-00-00', 'mmmm', 'zara@xyz.com', 'dddd', 'dddd', 'pic_1074.jpg'),
  </code></pre>