TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthika pommudu
NA
321
35k
While loop values pass to php update query by submit button
Jul 24 2020 4:07 AM
Hi all,Here my code by use while loop I will show the access number values in form after edit the field
name=
"veh_nos_a"
I wanna pass the values into update query via the submit button.
Anyone help to clear this.
have a good day!
While loop code:
$result2=$link->query(
"SELECT * FROM `Access_card` where unitentry='$unit_no'"
);
echo $result11 = mysqli_query($link,$result2);
$row = mysqli_fetch_array($result11,MYSQLI_ASSOC);
while
($row = $result2->fetch_assoc())
{
$accessnum = $row[
'accessnum'
];
?> <div
class
=
"row"
>
<div
class
=
"col-sm-6"
>
<label>Access card number</label>
<input type=
"text"
name=
"veh_nos_a"
id =
'accessnum'
value=
"<?php echo $accessnum; ?>"
>
</div>
</div>
<?
}
?>
<div
class
=
"col-sm-5"
>
<span
class
=
"fw-separator"
></span>
<input type=
"submit"
class
=
"previous-form action-button color-bg"
name=
"paym"
>
</div>
Update query:
if
(isset($_POST[
'paym'
]))
{
$access = mysqli_real_escape_string($link, $_POST[
'veh_nos_a'
]);
echo $access;
for
($count = 0; $count<count($access); $count++)
{
echo $access;
}
$result1=
"UPDATE `res_veh` SET `unit_no` = '$unit_no', access='$acess ' WHERE unit_no = '$unit_no'"
;
if
($link->query($result1) === TRUE)
{
echo
"Record updated successfully"
;
}
else
{
echo
"Error updating record: "
. $link->error;
}
}
else
{
echo
'error'
;
}
Reply
Answers (
0
)
Fatal error: Call to a member function bind_param() on boolean
Updated version of php from 7.3 to 7.4.