Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
KLUGLUG
Blood Service Portal
Commits
003ad8a5
Commit
003ad8a5
authored
Oct 26, 2019
by
rama chandra
Browse files
Update view.php
parent
a9aaf385
Changes
1
Hide whitespace changes
Inline
Side-by-side
admin/view.php
View file @
003ad8a5
...
...
@@ -2,8 +2,8 @@
require
(
'db.php'
);
include
(
"auth.php"
);
$id
=
$_REQUEST
[
'id'
];
$query
=
"SELECT * from bloo
where id='"
.
$id
.
"'
"
;
$query
=
"SELECT * from bloo "
;
$result
=
mysqli_query
(
$con
,
$query
)
or
die
(
mysqli_error
());
$row
=
mysqli_fetch_assoc
(
$result
);
?>
...
...
@@ -16,41 +16,23 @@ $row = mysqli_fetch_assoc($result);
</head>
<body>
<div
class=
"form"
>
<p><a
href=
"dashboard.php"
>
Dashboard
</a>
|
<a
href=
"insert.php"
>
Insert New Record
</a>
|
<a
href=
"logout.php"
>
Logout
</a></p>
<h1>
Update Record
</h1>
<p><a
href=
"index.php"
>
Home
</a>
|
<a
href=
"insert.php"
>
Insert New Record
</a>
|
<a
href=
"logout.php"
>
Logout
</a></p>
<h2>
View Records
</h2>
<table
width=
"100%"
border=
"1"
style=
"border-collapse:collapse;"
>
<thead>
<tr><th><strong>
S.No
</strong></th><th><strong>
Name
</strong></th><th><strong>
Blood Group
</strong></th><th><strong>
Age
</strong></th><th><strong>
Last donated
</strong></th><th><strong>
Mobile No
</strong></th><th><strong>
City
</strong></th><th><strong>
Edit
</strong></th><th><strong>
Delete
</strong></th></tr>
</thead>
<tbody>
<?php
$status
=
""
;
if
(
isset
(
$_POST
[
'new'
])
&&
$_POST
[
'new'
]
==
1
)
{
$id
=
$_REQUEST
[
'id'
];
$uname
=
$_REQUEST
[
'uname'
];
$blood
=
$_REQUEST
[
'blood'
];
$age
=
$_REQUEST
[
'age'
];
$dd
=
$_REQUEST
[
'dd'
];
$mobile
=
$_REQUEST
[
'mobile'
];
$city
=
$_REQUEST
[
'city'
];
$update
=
"update bloo set uname='"
.
$uname
.
"', blood='"
.
$blood
.
"', age='"
.
$age
.
"', dd='"
.
$dd
.
"',mobile='"
.
$mobile
.
"',city='"
.
$city
.
"' where id='"
.
$id
.
"'"
;
$result1
=
mysqli_query
(
$con
,
$update
)
or
die
(
mysqli_error
());
$status
=
"Record Updated Successfully. </br></br><a href='view.php'>View Updated Record</a>"
;
echo
'<p style="color:#FF0000;">'
.
$status
.
'</p>'
;
}
else
{
?>
<div>
<form
name=
"form"
method=
"post"
action=
""
>
<input
type=
"hidden"
name=
"new"
value=
"1"
/>
<input
name=
"id"
type=
"hidden"
value=
"
<?php
echo
$row
[
'id'
];
?>
"
/>
<p><input
type=
"text"
name=
"uname"
placeholder=
"Enter Name"
required
value=
"
<?php
echo
$row
[
'uname'
];
?>
"
/></p>
<p><input
type=
"text"
name=
"blood"
placeholder=
"Enter BLood Group"
required
value=
"
<?php
echo
$row
[
'blood'
];
?>
"
/></p>
<p><input
type=
"text"
name=
"age"
placeholder=
"Enter Age"
required
value=
"
<?php
echo
$row
[
'age'
];
?>
"
/></p>
<p><input
type=
"text"
name=
"dd"
placeholder=
"Enter Last donated"
required
value=
"
<?php
echo
$row
[
'dd'
];
?>
"
/></p>
<p><input
type=
"text"
name=
"mobile"
placeholder=
"Enter Mobile No"
required
value=
"
<?php
echo
$row
[
'mobile'
];
?>
"
/></p>
<p><input
type=
"text"
name=
"city"
placeholder=
"Enter City"
required
value=
"
<?php
echo
$row
[
'city'
];
?>
"
/></p>
<p><input
name=
"submit"
type=
"submit"
value=
"Update"
/></p>
</form>
<?php
}
?>
$count
=
1
;
$sel_query
=
"Select * from bloo ORDER BY id desc;"
;
$result
=
mysqli_query
(
$con
,
$sel_query
);
while
(
$row
=
mysqli_fetch_assoc
(
$result
))
{
?>
<tr><td
align=
"center"
>
<?php
echo
$count
;
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"uname"
];
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"blood"
];
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"age"
];
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"dd"
];
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"mobile"
];
?>
</td><td
align=
"center"
>
<?php
echo
$row
[
"city"
];
?>
</td><td
align=
"center"
><a
href=
"edit.php?id=
<?php
echo
$row
[
"id"
];
?>
"
>
Edit
</a></td><td
align=
"center"
><a
href=
"delete.php?id=
<?php
echo
$row
[
"id"
];
?>
"
>
Delete
</a></td></tr>
<?php
$count
++
;
}
?>
</tbody>
</table>
</div>
</div>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment