473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

view record using id

20
i can view the list of the users but when i'm trying to view the user record using their id, the output from the database doesn't show.

user_list.php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.     include 'connection.php';
  4.     $sql = "SELECT * FROM formequip, equipment, department WHERE formequip.equip_id = equipment.equip_id = department.depart_id";
  5.     $result = mysql_query($sql) or die('Query failed. ' . mysql_error());
  6.  
  7. ?>
  8.  
  9. <div  class="container" style="margin-top: 10px">
  10.      <table width="100%" border="0" class=" table table-striped table-bordered" id="mak_pekerja">
  11.         <thead>
  12.             <tr bgcolor="#666666">
  13.                 <th width="2%" nowrap="nowrap">Bil</th>
  14.                 <th width="2%" nowrap="nowrap">Jabatan</th>
  15.                 <th width="14%" nowrap="nowrap">Nama</th>
  16.                 <th width="7%" nowrap="nowrap">Kad Matrik</th>
  17.                 <th width="9%" nowrap="nowrap">No.Telefon</th>
  18.                 <th width="10%" nowrap="nowrap">Tarikh Pinjam</th>
  19.                 <th width="12%" nowrap="nowrap">Tarikh Hantar</th>
  20.                 <th width="15%" nowrap="nowrap">Aktiviti</th>
  21.                 <th width="15%" nowrap="nowrap">Perkara</th>
  22.                 <th width="15%" nowrap="nowrap">Kuantiti</th>
  23.                 <th width="15%" nowrap="nowrap">Status</th>
  24.                 <th width="16%" nowrap="nowrap">Tetapan</th>
  25.             </tr>
  26.         </thead>
  27.         <tbody>
  28.              <?php 
  29.                    $tmpCount = 1; 
  30.                        while ($row_lprn = mysql_fetch_assoc($result)) {?>        
  31.                     <tr bgcolor="#DDD">
  32.                       <td><?php echo $tmpCount; ?></td>
  33.                       <td><?php echo $row_lprn['department']; ?></td>
  34.                       <td><?php echo $row_lprn['stud_name']; ?></td>
  35.                       <td><?php echo $row_lprn['stud_id']; ?></td>
  36.                       <td><?php echo $row_lprn['stud_tel']; ?></td>
  37.                       <td><?php echo $row_lprn['stud_date_borrow']; ?></td>
  38.                       <td><?php echo $row_lprn['stud_date_return'];?></td>
  39.                       <td><?php echo $row_lprn['stud_activity']; ?></td>
  40.                       <td><?php echo $row_lprn['equip_type']; ?></td>
  41.                       <td><?php echo $row_lprn['stud_quantity']; ?></td>
  42.                       <td><?php echo $row_lprn['stud_status']; ?></td>
  43.                       <td><a href="update.php?id=<?php echo $row_lprn['id']; ?>" class="btn btn-mini btn-danger"> <i class="icon-list-alt icon-white"></i>Edit</a></td>
  44.                       <td><input type="hidden" name="id" value="<?php echo $row_lprn['id']; ?>" /></td>
  45.                     </tr>                        
  46.              <?php $tmpCount ++; }?>                                              
  47.         </tbody>
  48.      </table> 
update.php

Expand|Select|Wrap|Line Numbers
  1.  <?php
  2.         include('connection.php');
  3.  
  4.         $sql = "SELECT * FROM formequip WHERE id='".$_POST['id']."'";
  5.         $results = mysql_query($sql);
  6.  
  7.         $row = mysql_fetch_array($results);
  8.  
  9.         $id = $row_lprn['id'];
  10.         $stud_id = $row_lprn['stud_id'];
  11.         $equip_id = $row_lprn['equip_type'];
  12.         $stud_name = $row_lprn['stud_name'];
  13.         $stud_tel = $row_lprn['stud_tel'];
  14.         $stud_activity = $row_lprn['stud_activity'];
  15.         $stud_date_borrow = $row_lprn['stud_date_borrow'];
  16.         $stud_date_return = $row_lprn['stud_date_return'];
  17.         $equip_type = $row_lprn['equip_type'];
  18.         $stud_quantity = $row_lprn['stud_quantity'];
  19.  
  20.         $id = $_POST['id'];
  21.         $submit = $_POST['submit'];
  22.  
  23.         ?>
  24.  
  25. <p>
  26.         <div id="form">
  27.         <form name="update" action="update2.php" method="post">
  28.             <table width="800" align="center">
  29.                 <tr>
  30.                     <td>No. ID</td>
  31.                     <td>:</td>
  32.                     <td><?php echo "$id"; ?></td>
  33.                 </tr>
  34.                 <tr>
  35.                     <td>No. Matrik</td>
  36.                     <td>:</td>
  37.                     <td><?php echo "$stud_id"; ?></td>
  38.                 </tr>
  39.                 <tr>
  40.                     <td width="173">Jabatan</td>
  41.                     <td width="10">:</td>
  42.                     <td width="564"><?php echo "$department"; ?></td>
  43.                 </tr>
  44.                 <tr>
  45.                     <td>Nama Pemohon</td>
  46.                     <td>:</td>
  47.                     <td><?php echo "$stud_name"; ?></td>
  48.                 </tr>
  49.                 <tr>
  50.                     <td>No. Telefon</td>
  51.                     <td>:</td>
  52.                     <td><?php echo "$stud_tel"; ?></td>
  53.                 </tr>
  54.                 <tr>
  55.                     <td>Aktiviti</td>
  56.                     <td>:</td>
  57.                     <td><?php echo "$stud_activity"; ?></td>
  58.                 </tr>
  59.                 <tr>
  60.                     <td>Tarikh Pinjam</td>
  61.                     <td>:</td>
  62.                     <td><?php echo "$stud_date_borrow"; ?></td>
  63.                 </tr>
  64.                 <tr>
  65.                     <td>Tarikh Pulang</td>
  66.                     <td>:</td>
  67.                     <td><?php echo "$stud_date_return"; ?></td>
  68.                 </tr>
  69.                 <tr>
  70.                     <td>Perkara</td>
  71.                     <td>:</td>
  72.                     <td><?php echo "$equip_type"; ?></td>
  73.                 </tr>
  74.                 <tr>
  75.                     <td>Kuantiti</td>
  76.                     <td>:</td>
  77.                     <td><?php echo "$stud_quantity"; ?></td>
  78.                 </tr>
  79.                 <tr>
  80.                     <td>Status</td>
  81.                     <td>:</td>
  82.                     <td><label>
  83.                         <select name="stud_status" id="stud_status">
  84.                         <option selected="selected"></option>
  85.                         <option>Diluluskan</option>
  86.                         <option>Tidak Diluluskan</option>
  87.                         </select>
  88.                         </label>
  89.                     </td>
  90.                 </tr>
  91.  
  92.                 <p align="center">
  93.                 <input type="hidden" name="id" value="<?php echo $id; ?>">
  94.                 <input type="hidden" name="stud_name" value="<?php echo $stud_name; ?>">
  95.  
  96.                 </p>
  97.             </table><input name="submit" type="submit" id="submit" value="Kemaskini" />
  98.         </form><form action="user_list.php">
  99.     <input type="submit" value="kembali"></form>
  100.         </div>
  101.     </div>
  102. </div>
output:

http://postimg.org/image/s00wh1iaf/
Jan 6 '15 #1

✓ answered by Rabbit

Your update.php has no $row_lprn variable set anywhere.

6 1676
Exequiel
288 256MB
in your update.php in line number 4 in your query replace the $_POST['id'] with $_GET['id'].

Read about $_GET here http://php.net/manual/en/reserved.variables.get.php
Jan 7 '15 #2
leesyaa
20
i have replace it. still cant view the output :/
Jan 8 '15 #3
Exequiel
288 256MB
in user_list.php for line 43 and 44, change the $row_lprn['id'] with $row_lprn['equip_id']. I think the $row_lprn['id'] has no value or not existing in your tables fields.
Jan 9 '15 #4
leesyaa
20
it still doesnt display the input. i try changing all the 'POST' to 'GET'. the only output displayed are the id while others remain empty.
Jan 13 '15 #5
Rabbit
12,516 Expert Mod 8TB
Your update.php has no $row_lprn variable set anywhere.
Jan 13 '15 #6
IJAM
1
$q = isset($_GET['ID']) ? $_GET['ID'] : '';

$sql="SELECT ID, IC_NO, NAMA, NEGERI, Jantina FROM ahli WHERE ID= '".$q."' OR NEGERI= '".$e."'";

mcm ini ke.
Jan 18 '15 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Panchal V | last post by:
I want to access a variable length record in C, the format is as follows : +---+---+-----------+ | A | L | D A T A | +---+---+-----------+ A - Some Data (1 BYTE) L - Length the Data that...
2
by: rajvbprogramer | last post by:
here is my problem. i have two records. one containing 20 records and second containing 30 records. now i want the recordcount property to use and go to the 21 record. i m calculating the...
5
by: mukeshrasm | last post by:
Hi I am displaying record using php. I am giving the record structure in html format. Admin will allow user to view the no. of record user will view. <table>...
17
by: ganesh raj | last post by:
Hi, want to write an plsql code to update a single record using rowid where all the rows are duplicated could someone help me in this case. Prod_service_id Location feature ord...
0
by: Big Daddy | last post by:
I am trying to do all my DB access through LINQ. For example, I am trying to delete a record from the JobQueue table. There’s a couple ways I could do this: 1. Method 1 – The disadvantage is...
1
by: sknaina | last post by:
Hi Eveybody, I've a main form with a continuous subform based on 'DonorTranSmasterF' & 'DonorTranSdetailsF' , both tables are linked via 'DonorTransiD' field. I know & learn , How to save record...
1
by: mbbum88 | last post by:
Hi there, I'm still relatively new to Access and am trying to build a database to track applicants for jobs. The form I'm having a problem with is one for "Editing applications". I want to use...
2
by: raamay | last post by:
hello experts, i have fetched records from mysql database and against each record i want to place a update tag which when clicked will update the corresponding record using ajax and php. But here...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.