PHP Update Query using mysqli function - php

Here I have to update only category,sd,fd,assignto,reviewed by and file upload. So when the user clicks on update button it will go to the update.php and updates the necessary fields. But its not executing and its showing an a warning:
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match
number of parameters in prepared statement
Can somebody tell me what's wrong?
updateview.php
<form action="update.php" method="post" enctype="multipart/form-data" novalidate>
<?php
include_once('dbconn.php');
$srn = $_GET['srn'];
if($stmt = $mysqli->prepare("SELECT srn, client, type, fy, category, sd, fd, assignto, edoc, reviewed, upload FROM main WHERE srn=?")){
$stmt->bind_param("s",$_GET["srn"]);
$stmt->execute();
$stmt->bind_result($srn,$client,$type,$fy,$category,$sd,$fd,$assignto,$edoc,$reviewed,$upload);
$stmt->fetch();
$stmt->close();
}
?>
<label> <span>SRN</span>
<input name="srn" type="text" id="srn" size="15" readonly="readonly" maxlength="40" value="<?php echo $srn; ?>"/>
</label>
<label> <span>Client</span>
<select class="required" name="client" disabled="disabled"/>
<?php
if($stmt = $mysqli->prepare("SELECT cname FROM client")){
$stmt->execute();
$stmt->bind_result($cname);
while($stmt->fetch()){
?>
<option value="<?php echo $cname; ?>" <?php if($cname==$client){ echo "selected"; } ?>> <?php echo $cname; ?> </option>
<?php
} /* END OF WHILE LOOP */
$stmt->close();
} /* END OF PREPARED STATEMENT OF CLIENT */
?>
</select>
<input type="hidden" name="client" value = "<?php echo $row['client']; ?>" />
</label>
<label> <span>Type</span>
<select class="required" name="type" disabled="disabled"/>
<?php
if($stmt = $mysqli->prepare("SELECT type FROM entity")){
$stmt->execute();
$stmt->bind_result($type);
while($stmt->fetch()){
?>
<option value="<?php echo $type; ?>" <?php if($type==$type){ echo "selected"; } ?>> <?php echo $type; ?> </option>
<?php
} /* END OF WHILE LOOP */
$stmt->close();
} /* END OF PREPARED STATEMENT */
?>
</select>
<input type="hidden" name="type" value = "<?php echo $row['type']; ?>" />
</label>
<label> <span>Financial Year</span>
<select class="required" name="fy" disabled="disabled"/>
<?php
if($stmt = $mysqli->prepare("SELECT year FROM fy")){
$stmt->execute();
$stmt->bind_result($year);
while($stmt->fetch()){
?>
<option value="<?php echo $year; ?>" <?php if($year==$fy){ echo "selected"; } ?>> <?php echo $year; ?> </option>
<?php
} /* END OF WHILE LOOP */
$stmt->close();
} /* END OF PREPARED STATEMENT OF */
?>
</select>
<input type="hidden" name="fy" value = "<?php echo $row['fy']; ?>" />
</label>
<label> <span>Category</span>
<select class="required" name="category"/>
<?php
if($stmt = $mysqli->prepare("SELECT name FROM category")){
$stmt->execute();
$stmt->bind_result($name);
while($stmt->fetch()){
?>
<option value="<?php echo $name; ?>" <?php if($name==$category){ echo "selected"; } ?>> <?php echo $name; ?> </option>
<?php
} /* END OF WHILE LOOP */
$stmt->close();
} /* END OF PREPARED STATEMENT OF CATEGORY */
?>
</select>
</label>
<label> <span>Short Description</span>
<textarea required="required" name='sd'><?php echo $sd; ?></textarea>
</label>
<label> <span>Full Description</span>
<textarea required="required" name='fd'><?php echo $fd; ?></textarea>
</label>
<label> <span>Assign To</span>
<select class="required" name="assignto"/>
<?php
if($stmt = $mysqli->prepare("SELECT name FROM assignto")){
$stmt->execute();
$stmt->bind_result($name);
while($stmt->fetch()){
?>
<option value="<?php echo $name; ?>" <?php if($name==$name){ echo "selected"; } ?>> <?php echo $name; ?> </option>
<?php
}
$stmt->close();
}
?>
</select>
</label>
<label> <span>EDOC</span>
<input name="edoc" type="text" id="edoc" size="15" readonly="readonly" maxlength="40" value="<?php echo $edoc; ?>"/>
</label>
<label> <span>Reviewed By</span>
<select class="required" name="reviewed"/>
<?php
if($stmt = $mysqli->prepare("SELECT type FROM entity")){
$stmt->execute();
$stmt->bind_result($type);
while($stmt->fetch()){
?>
<option value="<?php echo $type; ?>" <?php if($type==$reviewed){ echo "selected"; } ?>> <?php echo $type; ?> </option>
<?php
}
$stmt->close();
}
?>
</select>
</label>
<label>
<span>Input Attachment</span>
<input type="file" name ="filename" required>
</label>
<button id='cancel' type='cancel'>Cancel</button>
<button id='send' type='submit'>Update</button>
</form>
update.php
<?php
include('dbconn.php');
$srn = $_POST['srn'];
$client = $_POST['client'];
$type = $_POST['type'];
$fy = $_POST['fy'];
$category = $_POST['category'];
$sd = $_POST['sd'];
$fd = $_POST['fd'];
$assignto = $_POST['assignto'];
$edoc = $_POST['edoc'];
$reviewed = $_POST['reviewed'];
$stmt = $mysqli->prepare("UPDATE main SET category=?,sd=?,fd=?,assignto=?,reviewed=?,upload=? WHERE srn=?");
$stmt->bind_param('sssssb',$srn,$category, $sd,$fd,$assignto,$reviewed,$upload);
$stmt->execute();
?>
dbconn.php
<?php
$host = "localhost";
$user = "root";
$pwd = "root";
$db = "eservice";
$mysqli = new mysqli($host,$user,$pwd,$db);
/* ESTABLISH CONNECTION */
if (mysqli_connect_errno()) {
echo "Failed to connect to mysql : " . mysqli_connect_error();
exit();
}
?>

$stmt->bind_param('sssssb',$category, $sd,$fd,$assignto,$reviewed,$upload);
here you got 1 types string and 6 params;
$stmt = $mysqli->prepare("UPDATE main SET category=?,sd=?,fd=?,assignto=?,reviewed=?,upload=? WHERE srn=?");
and here you got 7 ? Thats the problem, it should be :
$stmt->bind_param('sssssbd',$category, $sd,$fd,$assignto,$reviewed,$upload, $srn);

There are few problems in the code. Try solving them and see if the problem is solved.
select is not a self ending tag. Please correct that.
You are not initializing variable $uploads in update.php, It should be initialized with $_POST['filename'] This seems to be the actual problem
The select elements are readonly so the values won't be included in the posted form. Try adding hidden fields next to them and use these hidden fields to get the data instead in update.php

Related

How to get information from an already populated form

I am trying to update a database record using a submit button, however the form that information is being taken from has itself been populated by another submit button.
The PHP is below:
if (isset($_POST['edit']))
{
$editUser = User::locate($_POST['userSelect']);
$setCompany = Company::findCompany();
$exCompanyId = $editUser->user_company_id;
$isAdmin = $editUser->user_admin;
$eUserFirstname = $editUser->user_firstname;
$eUserLastname = $editUser->user_lastname;
$eUserUsername = $editUser->user_username;
$eUserEmail = $editUser->user_email;
$eUserCompany = $editUser->user_company;
$adminArray = array("Yes","No");
if ($exCompanyId > NULL)
{
$exCompany = Company::locateId($exCompanyId);
$companyValue = $exCompany->company_name;
}
else
{
$companyValue = "";
}
if ($isAdmin > 0)
{
$userAdmin = $adminArray[0];
}
else
{
$userAdmin = $adminArray[1];
}
}
if (isset($_POST['confirm']))
{
$updateUserRecord = User::locate($eUserUsername);
$newCompanyValue = $_POST['setCompany'];
$isAdmin = $_POST['userAdmin'];
$newCompany = Company::locate($newCompanyValue);
$companyId = $newCompany->company_id;
$updateUserRecord->user_company_id = $companyId;
$updateUserRecord->user_admin = $isAdmin;
$editUser->updateUserAdmin();
$message = "You have successfully updated the user account";
echo "<script type='text/javascript'>alert('$message');</script>";
}
The HTML code is below:
<form action="" method="post">
<p>
<label>First Name:</label>
<label><?php echo $eUserFirstname ?></label>
</p>
<p>
<label>Last Name:</label>
<label><?php echo $eUserLastname ?></label>
</p>
<p>
<label>Username:</label>
<label><?php echo $eUserUsername ?></label>
</p>
<p>
<label>Email Address:</label>
<label><?php echo $eUserEmail ?></label>
</p>
<p>
<label>User Company:</label>
<label><?php echo $eUserCompany ?></label>
</p>
<p>
<label>Set Company:</label>
<select name="setCompany">
<option><?php echo $companyValue ?></option>
<?php
foreach ($setCompany as $srow)
{
?>
<option id="<?=
$srow->company_id
?>">
<?=
$srow->company_name
?>
</option>
<?php
}
?>
</select>
</p>
<p>
<label>Administrator:</label>
<select name="userAdmin">
<option><?php echo $userAdmin ?></option>
<?php
foreach ($adminArray as $arow)
{
?>
<option>
<?=
$arow
?>
</option>
<?php
}
?>
</select>
</p>
<input type="submit" name="cancel" value="Cancel">
<input type="submit" name="confirm" value="Confirm">
</br>
</form>
From my investigations so far the variables aren't transferring to the 2nd if statement, and I'm not sure how to make them available to it.
Store the first form's submission in hidden input fields alongside your echo statements. For example: <input type="hidden" name="field_name" value="<?php echo htmlspecialchars($field); ?>">
Or, alternatively, update the DB after first form posts.

Populate data from dropdown list using a load button

I am trying to populate afew fields using a load button when I select from the dropdown list. However, the load button is not working and the php codes look fine to me. So I am wondering which part went wrong.
I am wondering if I should put the load button at AuthorityCode or below the form. However, I have tried both methods and both doesn't work.
<strong>Authority Code: </strong>
<select name=authorityid value=authorityid>Select Authority</option>
<option value = "">Select</option><br/>
<?php
$connection = new mysqli("localhost", "username", "password", "dbname");
$stmt = $connection->prepare("SELECT AuthorityId FROM AuthorityList");
$stmt->execute();
$stmt->bind_result($authorityid);
while($stmt->fetch()){
echo "<option value = '$authorityid'>$authorityid</option>";
}
$stmt->close();
$connection->close();
?>
</select>
<?php
if(isset($_POST["loadbtn"])){
$authorityid = $_POST["authorityid"];
$conn = new mysqli("localhost", "username", "password", "dbname");
$stmt = $conn->prepare("SELECT AuthorityName, Address, TelephoneNo, FaxNo FROM AuthorityList WHERE AuthorityId = '$authorityid'");
$stmt->execute();
$result = mysqli_query($stmt, $conn);
$details = mysqli_fetch_array($result);
$savedName = $details["AuthorityName"];
$savedAddress = $details["Address"];
$savedTel = $details["TelephoneNo"];
$savedFax = $details["FaxNo"];
}
// while ($row = $result->fetch_array(MYSQLI_NUM)){
// $authorityname = $row[0];
// $address = $row[1];
// $telephone = $row[2];
// $fax = $row[3];
// }
?>
<form action="" method="post" >
<input type="submit" value="Load" name="loadbtn"><br/><br/>
<strong>Authority Name: </strong> <input type="text" name="authorityname" value="<?php echo $savedName; ?>"/><br/>
<strong>Address: </strong> <input type="text" name="address" value="<?php echo $savedAddress; ?>"/><br/>
<strong>Telephone No: </strong> <input type="text" name="telephone" value="<?php echo $savedTel; ?>"/><br/>
<strong>Fax No: </strong> <input type="text" name="fax" value="<?php echo $savedFax; ?>"/><br/>
Change form to:
<form action="window.location.reload()" method="post" >
Your select values are not getting submitted as they are not part of the form. Also your 2nd query was not running properly. I've cheanged it below. Please take a look
Try this-
<strong>Authority Code: </strong>
<form action="" method="post" >
<select name="authorityid">Select Authority
<option value = "">Select</option><br/>
<?php
$connection = new mysqli("localhost", "username", "password", "dbname");
$stmt = $connection->prepare("SELECT AuthorityId FROM AuthorityList");
$stmt->execute();
$stmt->bind_result($authorityid);
while($stmt->fetch()){
echo "<option value = '$authorityid'>$authorityid</option>";
}
$stmt->close();
$connection->close();
?>
</select>
<?php
if(isset($_POST["loadbtn"])){
$authorityid = $_POST["authorityid"];
$conn = new mysqli("localhost", "username", "password", "dbname");
$qry = "SELECT AuthorityName, Address, TelephoneNo, FaxNo FROM AuthorityList WHERE AuthorityId = '$authorityid'";
$result = $conn->query($qry);
$details = mysqli_fetch_array($result);
$savedName = $details["AuthorityName"];
$savedAddress = $details["Address"];
$savedTel = $details["TelephoneNo"];
$savedFax = $details["FaxNo"];
}
?>
<input type="submit" value="Load" name="loadbtn"><br/><br/>
<strong>Authority Name: </strong>
<input type="text" name="authorityname" value="<?php echo isset($savedName) ? $savedName : ''; ?>"/>
<br/>
<strong>Address: </strong>
<input type="text" name="address" value="<?php echo isset($savedAddress) ? $savedAddress : ''; ?>"/>
<br/>
<strong>Telephone No: </strong>
<input type="text" name="telephone" value="<?php echo isset($savedTel) ? $savedTel : ''; ?>"/>
<br/>
<strong>Fax No: </strong>
<input type="text" name="fax" value="<?php echo isset($savedFax) ? $savedFax : ''; ?>"/>
<br/>
</form>
Your error seems to be from mysql part of the code. Below you'll find a sample code that has mysql part removed from it and is running-
<!DOCTYPE html>
<html>
<head>
<title>Fix</title>
</head>
<body>
<strong>Authority Code: </strong>
<form action="" method="post" >
<select name="authorityid">Select Authority
<option value = "">Select</option><br/>
<?php
echo "<option value = '123'>123</option>";
echo "<option value = '234'>234</option>";
echo "<option value = '345'>345</option>";
echo "<option value = '456'>456</option>";
?>
</select>
<?php
if(isset($_POST["loadbtn"])){
$authorityid = $_POST["authorityid"];
if ($authorityid == '123') {
$savedName = 'nameTest';
$savedAddress = 'addressTest';
$savedTel = 'telTest';
$savedFax = 'faxTest';
}
}
?>
<input type="submit" value="Load" name="loadbtn"><br/><br/>
<strong>Authority Name: </strong>
<input type="text" name="authorityname" value="<?php echo isset($savedName) ? $savedName : ''; ?>"/>
<br/>
<strong>Address: </strong>
<input type="text" name="address" value="<?php echo isset($savedAddress) ? $savedAddress : ''; ?>"/>
<br/>
<strong>Telephone No: </strong>
<input type="text" name="telephone" value="<?php echo isset($savedTel) ? $savedTel : ''; ?>"/>
<br/>
<strong>Fax No: </strong>
<input type="text" name="fax" value="<?php echo isset($savedFax) ? $savedFax : ''; ?>"/>
<br/>
</form>
</body>
</html>
Edited: changed the mysqli_query function so that it works properly.

How to add to this update SQL statement and make a drop down list too for it

Okay i have this SQL statement for update which works find but I want to add locations which is in te_venue table after adding the location into sql i want for locations to be a drop down list which user can pick one location from list and when clicked on update it should update.
This is the php code that I have already (I need to add location into this)
<?php
$eventID = $_GET['id'];
if(isset($_POST['submit']))
{
$title = $_POST['title'];
$startdate = $_POST['startdate'];
$enddate = $_POST['enddate'];
$price = $_POST['price'];
$description = $_POST['description'];
$sql = "UPDATE te_events SET eventTitle='$title',eventStartDate='$startdate',eventEndDate='$enddate',eventPrice='$price',eventDescription='$description' WHERE eventID=$eventID";
if ($conn->query($sql) === TRUE)
{
header('Location:edit.php');
}
else
{
echo "Error updating record";
}
}
$sql = "SELECT * FROM te_events where eventID='$eventID'";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
{
$eventTitle = $row['eventTitle'];
$eventDescription = $row['eventDescription'];
$eventStartDate = $row['eventStartDate'];
$eventEndDate = $row['eventEndDate'];
$eventPrice = $row['eventPrice'];
}
?>
And this is where i want to have a drop down list for location.
<form method="post" action="">
<label for="title">Title</label><br/>
<input type="text" name="title" required/ value="<?php echo $eventTitle; ?>"><br/>
<label for="startdate">Start Date</label><br/>
<input type="date" name="startdate" required/ value="<?php echo $eventStartDate; ?>"><br/>
<label for="enddate">End Date</label><br/>
<input type="date" name="enddate" required/ value="<?php echo $eventEndDate; ?>"><br/>
<label for="price">Price (£)</label><br/>
<input type="number" step="any" name="price" required/ value="<?php echo $eventPrice; ?>"><br/>
<label for="description">Description</label><br/>
<textarea name="description" cols="55" rows="5"><?php echo $eventDescription; ?></textarea><br/>
<input type="submit" name="submit" value="Update" class="button">
</form>
Here is a screenshot of my tables too it might help.
https://postimg.org/image/6ui8nsi55/
Do you want something like this? Getting the location from te_venue and adding the results to a select?
<select>
<?php
$sql = "SELECT location FROM te_venue";
$result = $conn->query($sql);
while($row = $result->fetch_assoc())
}
?>
<option value="<?php echo $row['location'];?>"><?php echo $row['location'];?> </option>
<?php
}
?>
</select>
<label for="location">Choose a location: </label>
<select class="form-control" name="location">
<option value="London">London</option>
<option value="Paris">Paris</option>
<option value="Rome">Rome</option>
<option value="Berlin">Berlin</option>
<option value="Moscow">Moscow</option>
</select>

How to create a selection dropdown in php form

I am working on a project and would like to give the user per-determined values when updating a record.
Here is my code so far.
<?php
// if there are any errors, display them
if ($error != '')
{
echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>';
}
?>
<form action="" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<div>
<p><strong>ID:</strong> <?php echo $id; ?></p>
<strong>School Name:</strong> <input type="text" name="Name" value="<?php echo $Name; ?>"/><br/><br>
<strong>Status:</strong> <input type="text" name="Status" value="<?php echo $Status; ?>"/><br/><br>
<strong>Comments:</strong> <input type="text" name="Comments" value="<?php echo $Comments; ?>"/><br/><br>
<strong>Type:</strong> <input type="text" name="Type" value="<?php echo $Type; ?>"/><br/><br>
<input type="submit" name="submit" value="Submit">
</div>
</form>
</body>
</html>
<?php
}
// connect to the database
include('connect-db.php');
// check if the form has been submitted. If it has, process the form and save it to the database
if (isset($_POST['submit']))
{
// confirm that the 'id' value is a valid integer before getting the form data
if (is_numeric($_POST['id']))
{
// get form data, making sure it is valid
$id = $_POST['id'];
$Name = mysql_real_escape_string(htmlspecialchars($_POST['Name']));
$Status = mysql_real_escape_string(htmlspecialchars($_POST['Status']));
$Comments = mysql_real_escape_string(htmlspecialchars($_POST['Comments']));
$Type = mysql_real_escape_string(htmlspecialchars($_POST['Type']));
// check that firstname/lastname fields are both filled in
if ($Name == '' || $Type == '')
{
// generate error message
$error = 'ERROR: Please fill in all required fields!';
//error, display form
renderForm($id, $Name, $Status, $Comments, $Type, $error);
}
else
{
// save the data to the database
mysql_query("UPDATE Schools SET Name='$Name', Status='$Status', Comments='$Comments', Type='$Type' WHERE id='$id'")
or die(mysql_error());
// once saved, redirect back to the view page
header("Location: view.php");
}
}
else
{
// if the 'id' isn't valid, display an error
echo 'Error!';
}
}
else
// if the form hasn't been submitted, get the data from the db and display the form
{
// get the 'id' value from the URL (if it exists), making sure that it is valid (checing that it is numeric/larger than 0)
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] > 0)
{
// query db
$id = $_GET['id'];
$result = mysql_query("SELECT * FROM Schools WHERE id=$id")
or die(mysql_error());
$row = mysql_fetch_array($result);
// check that the 'id' matches up with a row in the databse
if($row)
{
// get data from db
$Name = $row['Name'];
$Status = $row['Status'];
$Comments = $row['Comments'];
$Type = $row['Type'];
// show form
renderForm($id, $Name, $Status, $Comments, $Type, '');
}
else
// if no match, display result
{
echo "No results!";
}
}
else
// if the 'id' in the URL isn't valid, or if there is no 'id' value, display an error
{
echo 'Error!';
}
}
?>
I am wanting to replace the status text filed with a drop down list of options.
Replace your <input by <select :
<form action="" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<div>
<p><strong>ID:</strong> <?php echo $id; ?></p>
<strong>School Name:</strong> <input type="text" name="Name" value="<?php echo $Name; ?>"/><br/><br>
<!-- <strong>Status:</strong> <input type="text" name="Status" value="<?php echo $Status; ?>"/><br/><br>-->
<strong>Status:</strong> <select name="Status">
<option value="1">Status 1</option>
<option value="2">Status 2</option>
</select>
<strong>Comments:</strong> <input type="text" name="Comments" value="<?php echo $Comments; ?>"/><br/><br>
<strong>Type:</strong> <input type="text" name="Type" value="<?php echo $Type; ?>"/><br/><br>
<input type="submit" name="submit" value="Submit">
</div>
</form>
If your statuses are in a table, fill the <select> with a query :
<form action="" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>"/>
<div>
<p><strong>ID:</strong> <?php echo $id; ?></p>
<strong>School Name:</strong> <input type="text" name="Name" value="<?php echo $Name; ?>"/><br/><br>
<!-- <strong>Status:</strong> <input type="text" name="Status" value="<?php echo $Status; ?>"/><br/><br>-->
<strong>Status:</strong> <select name="Status">
<?php
$result = mysql_query("SELECT * FROM tbl_status",$cnx);
while ( $row = mysql_fetch_array($result) )
echo "<option value='" . $row["id"] . "'>" . $row["text"] . "</option>";
?>
</select>
<strong>Comments:</strong> <input type="text" name="Comments" value="<?php echo $Comments; ?>"/><br/><br>
<strong>Type:</strong> <input type="text" name="Type" value="<?php echo $Type; ?>"/><br/><br>
<input type="submit" name="submit" value="Submit">
</div>
</form>
You could use the html <datalist> or the <select> tag.
I hope I could help.
First of all you need to switch from mysql_* to mysqli_* as it going to get removed in php 7.0 I'm using this function i created and it might help you
here is the php code
function GetOptions($request)
{
global $con;
$sql = "SELECT * FROM data GROUP BY $request ORDER BY $request";
$sql_result = mysqli_query($con, $sql) or die('request "Could not execute SQL query" ' . $sql);
while ($row = mysqli_fetch_assoc($sql_result)) {
echo "<option value='" . $row["$request"] . "'" . ($row["$request"] == $_REQUEST["$request"] ? " selected" : "") . ">" . $row["$request"] . "$x</option>";
}
}
and the html code goes like
<label>genre</label>
<select name="genre">
<option value="all">all</option>
<?php
GetOptions("genre");
?>
</select>

PHP Multiple Checkbox;

I have problem, I am trying to create a form with a few checkboxes, each assigned a different value, i just can update value first and last, between not working, can you help me?
Check.php
<div class="top-on">
<div class="top-on1">
<p class="text-center"> <?php echo $row['username'];?></p>
<br>
<select class="form-control col-sm-12" name="edit_level">
<?php
global $pdo;
$sql = $pdo->query("SELECT * FROM level");
while ( $row_c = $sql->fetch(PDO::FETCH_ASSOC) ) {
?>
<option <?php if($row_c["level"]==$row["level"])
{
echo "selected=\"selected\"";
}?>
value="<?php echo $row_c['level']?>"> <?php echo $row_c['name'];?> </opition>
<?php } ?>
</select>
</div>
<label style="float: right;">
<input type="checkbox" class="checkbox" name="idlevel[]" value="<?php echo $row['id'];?>"> </label>
<div class="clearfix"> </div>
</div>
page Control.php
function edit_level(){
global $pdo;
$sql1="SELECT * From user ";
$stmt1 = $pdo->query($sql1);
if(isset($this->btnlevel))
{
for($i=0;$i<$stmt1->rowCount();$i++){
$elve=$this->idlevel[$i];
$sql ="UPDATE user SET level='$this->editlevel' WHERE id='".$elve."'";
$upt = $pdo->prepare($sql);
$upt->execute();
}
}
}

Categories