php - how to make a scrollable table using css -


my table has many columns resulted over-spanning in width. want make scrollable horizontally fit in screen , more neat , organized. guess css property overflow hidden. dont know put html codes. hope can help.

<?php  $servername = "kwe-pc\sqlexpress";  $connectioninfo = array("database" => "customerdb", "uid" => "dbadmin", "pwd" => "kwe");  $conn = sqlsrv_connect($servername, $connectioninfo);  if ($conn === false) {      die(print_r(sqlsrv_errors(), true));  }  //declare sql statement query database  $query = "select * customer_details";    //execute sql query , return records  $result = sqlsrv_query($conn, $query)          or die(print_r(sqlsrv_errors(), true));  //show results in table    $o = '<table border=1 id="mytable">           <thead>           <tr>           <th>&nbsp</th>           <th>rec number</th>           <th>customer id</th>           <th>customer name</th>           <th>sec-registered name</th>           <th>tin number</th>           <th>store type</th>           <th>size of business</th>           <th>seller id</th>           <th>date of establishment</th>           <th>telephone#/fax</th>           <th>payment terms</th>           <th>shipping instructions</th>           <th>number of doors</th>           <th>number of warehouses</th>           <th>owner</th>           <th>purchaser/s</th>           <th>accounting head</th>           <th>warehouse head</th>           <th>other personnel</th>           <th>payment terms 2</th>           <th>collection schedule</th>           <th>discount</th>           <th>volume</th>           <th>merchandising</th>           <th>vehicle</th>           <th>distribution</th>           <th>csl</th>           <th>assortment</th>           <th>pricing</th>           <th>margin</th>           <th>price</th>           <th>promotion</th>           <th>people</th>           <th>others</th>           <th>replenishment orders</th>           <th>assortment/merchandising</th>           <th>new products</th>           <th>pricing/promotion</th>           <th>picture</th>           </tr>           </thead><tbody>';    while ($record = sqlsrv_fetch_array($result)) {      $o .= '<tr><td><input type=radio name=id value=' . $record ['rec_no'] . '></td>';      $o .= '<td>' . $record ['rec_no'] . '</td>';      $o .= '<td>' . $record ['cust_id'] . '</td>';      $o .='<td>' . $record ['cust_name'] . '</td>';      $o .='<td>' . $record ['sec_name'] . '</td>';      $o .='<td>' . $record ['tin number'] . '</td>';      $o .='<td>' . $record ['store_type'] . '</td>';      $o .='<td>' . $record ['size of business'] . '</td>';      $o .='<td>' . $record ['seller_id'] . '</td>';      $o .='<td>' . date('f d, y', strtotime($record ['date of establishment'])) . '</td>';      $o .='<td>' . $record ['telephone/fax'] . '</td>';      $o .='<td>' . $record ['payment terms'] . '</td>';      $o .='<td>' . $record ['shipping instructions'] . '</td>';      $o .='<td>' . $record ['number of doors'] . '</td>';      $o .='<td>' . $record ['number of warehouses'] . '</td>';      $o .='<td>' . $record ['owner'] . '</td>';      $o .='<td>' . $record ['purchaser(s)'] . '</td>';      $o .='<td>' . $record ['accounting head'] . '</td>';      $o .='<td>' . $record ['warehouse head'] . '</td>';      $o .='<td>' . $record ['other personnel'] . '</td>';      $o .='<td>' . $record ['payment terms 2'] . '</td>';      $o .='<td>' . $record ['collection schedule'] . '</td>';      $o .='<td>' . $record ['discount'] . '</td>';      $o .='<td>' . $record ['volume'] . '</td>';      $o .='<td>' . $record ['merchandising'] . '</td>';      $o .='<td>' . $record ['marketing vehicle'] . '</td>';      $o .='<td>' . $record ['distribution'] . '</td>';      $o .='<td>' . $record ['csl'] . '</td>';      $o .='<td>' . $record ['assortment'] . '</td>';      $o .='<td>' . $record ['pricing'] . '</td>';      $o .='<td>' . $record ['margin'] . '</td>';      $o .='<td>' . $record ['price'] . '</td>';      $o .='<td>' . $record ['promotion'] . '</td>';      $o .='<td>' . $record ['people'] . '</td>';      $o .='<td>' . $record ['others'] . '</td>';      $o .='<td>' . $record ['replenishment orders'] . '</td>';      $o .='<td>' . $record ['assortment/merchandising'] . '</td>';      $o .='<td>' . $record ['new products'] . '</td>';      $o .='<td>' . $record ['pricing/promotions'] . '</td>';      $o .='<td><img height=127 width=127 src="data:image/png;base64,' . $record['image'] . '"></td>';      $o .='</tr>';  }    $o .= '</tbody></table>';  ?>  <form action="delete.php" method="post">      <?php echo $o; ?>      <br><input type="submit" value="delete" name="submit">  </form>  <?php    if (isset($_post['submit'])) {      $servername = "kwe-pc\sqlexpress";      $connectioninfo = array("database" => "customerdb", "uid" => "dbadmin", "pwd" => "kwe");      $conn = sqlsrv_connect($servername, $connectioninfo);      if ($conn === false) {          die(print_r(sqlsrv_errors(), true));      }      if(isset($_post['id']) && !empty($_post['id'])){      $sql = "delete customer_details rec_no =" . $_post['id'];      sqlsrv_query($conn, $sql);  	$ids = $_post['id'];      echo "row record number: " . $ids . " has been deleted!";      }else{          echo "id empty";      }  }  ?>

in css

#mytable{overflow-x: scroll} 

http://www.w3schools.com/cssref/css3_pr_overflow-x.asp


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -