-
Notifications
You must be signed in to change notification settings - Fork 0
/
restaurant_list.php~
78 lines (60 loc) · 1.68 KB
/
restaurant_list.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
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start();
?>
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password="sourcefuse"; // Mysql password
$db_name="restaurant"; // Database name
$tbl_name="restaurant_list"; // Table name
//define variables
$user_id = $name = $location = $cusines = $contactno ="";
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
if(!isset($login_session)){
// get value of id that sent from address bar
$sql="SELECT * FROM restaurant_list";
//print_r($sql);die;
$result=mysql_query($sql);
}
else{
header("Location:index.php");
}
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td align="center"><strong>user id</strong></td>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>location</strong></td>
<td align="center"><strong>cusines</strong></td>
<td align="center"><strong>contact no.</strong></td>
<td align="center"><strong>delete</strong></td>
<td align="center"><strong>Update</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><?php echo $rows['user_id'];?></td>
<td><?php echo $rows['name']; ?></td>
<td><?php echo $rows['location']; ?></td>
<td><?php echo $rows['cusines']; ?></td>
<td><?php echo $rows['contactno']; ?></td>
<td align="center"><a href="delete.php?id=<?php echo $rows['id']; ?>">delete</a></td>
<td align="center"><a href="update.php?id=<?php echo $rows['id']; ?>">update</a></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<a href="logout.php">logout</a>
<?php
mysql_close();
?>