php - One row of data can't be shown -


check this

i newbie , have no idea why nothing shown on "detail" tab did insert data database. 1 me on this?

<?php require ("data/taxidata.php");   class taxicontroller {  function createoverviewtable() {     $result = "         <table class='overviewtable'>             <tr>                 <td></td>                 <td></td>                 <td><b>id</b></td>                 <td><b>name</b></td>                 <td><b>gender</b></td>                 <td><b>faculty</b></td>                 <td><b>cartype</b></td>                 <td><b>car plate number</b></td>                 <td><b>price</b></td>                 <td><b>detail</b></td>             </tr>";      $itaxiarray = $this->getitaxibytype('%');      foreach ($itaxiarray $key => $value) {         $result = $result .                 "<tr>                     <td><a href='add.html?update=$value->id'>update</a></td>                     <td><a href='#' onclick='showconfirm($value->id)'>delete</a></td>                     <td>$value->id</td>                     <td>$value->name</td>                     <td>$value->gender</td>                         <td>$value->faculty</td>                      <td>$value->type</td>                     <td>$value->plate</td>                     <td>$value->price</td>                     <td>$value->detail</td>                 </tr>";     }      $result = $result . "</table>";     return $result; }  function createitaxidropdownlist() {     $taxidata = new taxidata();     $result = "<form action = '' method = 'post' width = '200px'>                 please select type:                  <select name = 'types' >                     <option value = '%' >all</option>                     " . $this->createoptionvalues($this->getitaxitypes()) .             "</select>                  <input type = 'submit' value = 'search' />                 </form>";      return $result; }  function createoptionvalues(array $valuearray) {     $result = "";      foreach ($valuearray $value) {         $result = $result . "<option value='$value'>$value</option>";     }      return $result; }  function createitaxitables($types) {     $taxidata = new taxidata();     $itaxiarray = $taxidata->getitaxibytype($types);     $result = "";       foreach ($itaxiarray $key => $itaxi) {         $result = $result .                 "<table class = 'itaxitable'>                     <tr>                         <th rowspan='6' width = '150px' ><img runat = 'server' src = '$itaxi->image' /></th>                         <th width = '75px' >name: </th>                         <td>$itaxi->name</td>                     </tr>                      <tr>                         <th>gender: </th>                         <td>$itaxi->gender</td>                     </tr>                      <tr>                         <th>faculty: </th>                         <td>$itaxi->faculty</td>                     </tr>                      <tr>                         <th>car type: </th>                         <td>$itaxi->type</td>                     </tr>                      <tr>                         <th>car plate: </th>                         <td>$itaxi->plate</td>                     </tr>                      <tr>                         <th>detail: </th>                         <td>$itaxi->detail</td>                     </tr>                    </table>";     }     return $result; }  function getimages() {      $handle = opendir("images/ump");       while ($image = readdir($handle)) {         $images[] = $image;     }      closedir($handle);       $imagearray = array();     foreach ($images $image) {         if (strlen($image) > 2) {             array_push($imagearray, $image);         }     }       $result = $this->createoptionvalues($imagearray);     return $result; }       function insertitaxi() {     $name = $_post["txtname"];     $gender = $_post["txtgender"];     $faculty = $_post["txtfaculty"];     $type = $_post["txtcar type"];     $plate = $_post["txtcar plate number"];     $price = $_post["txtprice"];     $detail = $_post["txtdetail"];       $itaxi = new taxientity(-1, $name, $gender, $faculty, $type, $plate, $price);     $taxidata = new taxidata();     $taxidata->insertitaxi($itaxi); }  function updateitaxi($id) {    $name = $_post["txtname"];     $gender = $_post["txtgender"];     $faculty = $_post["txtfaculty"];     $type = $_post["ddlcar type"];     $plate = $_post["txtcar plate number"];     $price = $_post["txtprice"];      $detail = $_post["txtdetail"];       $itaxi = new taxientity(-1, $name, $gender, $faculty, $type, $plate, $price, $detail);     $taxidata = new taxidata();     $taxidata->updateitaxi($id, $itaxi); }  function deleteitaxi($id)  {     $taxidata = new taxidata();     $taxidata->deleteitaxi($id); }   function getitaxibyid($id) {    $taxidata = new taxidata();     return $taxidata->getitaxibyid($id); }  function getitaxibytype($type) {    $taxidata = new taxidata();     return $taxidata->getitaxibytype($type); }  function getitaxitypes() {   $taxidata = new taxidata();     return $taxidata->getitaxitypes(); }  } ?> 

so, taxidata.php. maybe something's going wrong here too.

    <?php 

require ("entities/taxientity.php");

class taxidata {

function getitaxitypes() {     require ('mysql_connect.php');      mysql_connect($db_host, $db_username, $db_pass) or die(mysql_error());     mysql_select_db($db_name);     $result = mysql_query("select distinct type itaxi") or die(mysql_error());     $types = array();       while ($row = mysql_fetch_array($result)) {         array_push($types, $row[0]);     }       mysql_close();     return $types; }   function getitaxibytype($type) {     require ('mysql_connect.php');      mysql_connect($db_host, $db_username, $db_pass) or die(mysql_error());      mysql_select_db($db_name);      $query = "select * itaxi type '$type'";     $result = mysql_query($query) or die(mysql_error());     $taxiarray = array();       while ($row = mysql_fetch_array($result)) {         $id = $row[0];         $name = $row[1];         $gender = $row[2];         $faculty = $row[3];         $type = $row[4];         $plate = $row[5];         $price = $row[6];         $detail = $row[7];          $itaxi = new taxientity($id, $name, $gender, $faculty, $type, $plate, $price, $detail);         array_push($taxiarray, $itaxi);     }      mysql_close();     return $taxiarray; }  function getitaxibyid($id) {     require ('mysql_connect.php');       mysql_connect($db_host, $db_username, $db_pass) or die(mysql_error());      mysql_select_db($db_name);      $query = "select * itaxi id = $id";     $result = mysql_query($query) or die(mysql_error());       while ($row = mysql_fetch_array($result)) {         $name = $row[1];         $gender = $row[2];         $faculty = $row[3];         $type = $row[4];         $plate = $row[5];         $price = $row[6];         $detail = $row[7];          $itaxi = new taxientity($id, $name, $gender, $faculty, $type, $plate, $price, $detail);     }      mysql_close();     return $itaxi; }  function insertitaxi(taxientity $itaxi) {     $query = sprintf("insert itaxi                       (name, gender, faculty,type,plate,price,detail)                       values                       ('%s','%s','%s','%s','%s','%s','%s','%s')",             mysql_real_escape_string($itaxi->name),             mysql_real_escape_string($itaxi->gender),             mysql_real_escape_string($itaxi->faculty),             mysql_real_escape_string($itaxi->type),             mysql_real_escape_string($itaxi->plate),             mysql_real_escape_string($itaxi->price),              mysql_real_escape_string($itaxi->detail));     $this->performquery($query); }  function updateitaxi($id, taxientity $itaxi) {     $query = sprintf("update itaxi                         set name = '%s', gender = '%s', faculty = '%s', type = '%s',                         price = '%s', detail = '%s'                       id = $id",            mysql_real_escape_string($itaxi->name),             mysql_real_escape_string($itaxi->gender),             mysql_real_escape_string($itaxi->faculty),             mysql_real_escape_string($itaxi->type),             mysql_real_escape_string($itaxi->plate),             mysql_real_escape_string($itaxi->price),              mysql_real_escape_string($itaxi->detail));      $this->performquery($query); }  function deleteitaxi($id) {     $query = "delete itaxi id = $id";     $this->performquery($query); }  function performquery($query) {    require ('mysql_connect.php');       mysql_connect($db_host, $db_username, $db_pass) or die(mysql_error());      mysql_select_db($db_name);       mysql_query($query) or die(mysql_error());     mysql_close(); } 

} ?>

thanks!

update: database database

this after debugging outcome of debugging

looks missing bit of code

function insertitaxi() {     $name = $_post["txtname"];     $gender = $_post["txtgender"];     $faculty = $_post["txtfaculty"];     $type = $_post["txtcar type"];     $plate = $_post["txtcar plate number"];     $price = $_post["txtprice"];     $detail = $_post["txtdetail"];       $itaxi = new taxientity(-1, $name, $gender, $faculty, $type, $plate, $price);     $taxidata = new taxidata();     $taxidata->insertitaxi($itaxi); } 

the line $itaxi = new taxientity(-1, $name, $gender, $faculty, $type, $plate, $price); looks should $itaxi = new taxientity(-1, $name, $gender, $faculty, $type, $plate, $price, $detail);

just missing field $detail on end looks of it. give try.

update - try fixing missing plate on other function -

function updateitaxi($id, taxientity $itaxi) {     $query = sprintf("update itaxi                         set name = '%s', gender = '%s', faculty = '%s', type = '%s',                         price = '%s', detail = '%s'                       id = $id",            mysql_real_escape_string($itaxi->name),             mysql_real_escape_string($itaxi->gender),             mysql_real_escape_string($itaxi->faculty),             mysql_real_escape_string($itaxi->type),             mysql_real_escape_string($itaxi->plate),             mysql_real_escape_string($itaxi->price),              mysql_real_escape_string($itaxi->detail));      $this->performquery($query); } 

change update include plate = %s

"update itaxi set name = '%s', gender = '%s', faculty = '%s', type = '%s', plate = '%s', price = '%s', detail = '%s' id = $id", 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -