forked from mirza9252/CURD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathview.php
65 lines (59 loc) · 1.45 KB
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<html>
<body>
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
//connect database
include 'db_connect.php';
//selecting data
$sql="select id, name, age, sex, email, create_date, password from user_profile";
//query the database
$rs=mysql_query($sql) or die($sql.">>".mysql_error());
//count how many records found
$num=mysql_num_rows($rs);
if($num>0){ //check if more than 0 record found
?>
<table align="center" border='1'>
<tr>
<th>Id</th>
<th>Name</th>
<th>Age</th>
<th>Sex</th>
<th>Email</th>
<th>Crate Date</th>
<th>Password</th>
</tr>
<?php
//retrieve our table contents
while($row=mysql_fetch_array($rs)){
//extract row
//this will make $row['id'] to
extract($row);
//creating new table row per record
?>
<tr>
<td><?php echo $id; ?></td>
<td><?php echo $name; ?></td>
<td><?php echo $age; ?></td>
<td><?php echo $sex; ?></td>
<td><?php echo $email; ?></td>
<td><?php echo $create_date; ?></td>
<td><?php echo $password; ?></td>
</tr>
<?php
}
?>
</table>
<?php
}
else
{ //if no records found
echo "No records found.";
}
?>
</body
>
<button style="width:65;height:65;background-color:lightgreen" onclick="location.href='http://localhost/profile/index.php'">Bcak to Main Page</button><br/>
</html>