|
|
|
สอบถามการแก้ไข update เมื่อกดแล้วไม่ขึ้นเออเร่อขึ้นแต่หน้าว่างเปล่าค่ะ |
|
|
|
|
|
|
|
Code (C#)
<?php
ini_set('display_errors', 1);
error_reporting(~0);
$serverName = "localhost";
$userName = "sa";
$userPassword = "";
$dbName = "nomneaw";
$striduser = null;
if(isset($_GET["id"]))
{
$striduser = $_GET["id"];
}
$serverName = "localhost";
$userName = "root";
$userPassword = "";
$dbName = "nomneaw";
$Con = mysqli_connect($serverName,$userName,$userPassword,$dbName);
$SQL = "SELECT * FROM register WHERE id = '".$striduser."' ";
$Query = mysqli_query($Con,$SQL);
$Result = mysqli_fetch_array($Query,MYSQLI_ASSOC);
?>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<h3>Edit Staff</h3>
<p> <hr>
<div class="col-xs-12 col-sm-12 col-md-12">
<input type="hidden" name="id" id="id" value="<?php echo $Result['id'];?>" />
<div class="box-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Firstname</label>
<input type="text" class="form-control" id="firstname" name="firstname" value="<?php echo $Result['firstname'];?>">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Lastname</label>
<input type="text" class="form-control" id="lastname" name="lastname" value="<?php echo $Result['lastname'];?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<label>Username</label>
<input type="text" id="username" name="username" class="form-control" value="<?php echo $Result['username'];?>">
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Password</label>
<input type="password" id="password" name="password" class="form-control"value="<?php echo $Result['password'];?>" >
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<label>Confirm Password</label>
<input type="password" id="repassword" name="repassword" class="form-control"value="<?php echo $Result['repassword'];?>">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label>Telephone</label>
<input type="text" id="tel" maxlength="10" name="tel" class="form-control" value="<?php echo $Result['tel'];?>" >
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label>Status</label>
<input type="text" id="status" maxlength="10" name="status" class="form-control" value="<?php echo $Result['status'];?>" readonly="readonly" >
</div>
</div>
</div>
<a href="admin_page.php"><button type="button" class="btn btn-danger pull-left" >Undo</button></a>
<button type="submit" name="Submit" class="btn btn-warning pull-right button_save" >Save</button>
</div>
</div>
</div>
</div>
Code (C#)
<?php
ini_set('display_errors', 1);
error_reporting(~0);
$serverName = "localhost";
$userName = "root";
$userPassword = "";
$dbName = "nomneaw";
$conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
$sql = "UPDATE register SET
firstname = '".$_POST["firstname"]."',
lastname = '".$_POST["lastname"]."',
username = '".$_POST["username"]."',
`password` = '".$_POST["password"]."',
repassword = '".$_POST["repassword"]."',
tel = '".$_POST["tel"]."',
`status` = '".$_POST["status"]."'
WHERE id = '".$_POST["id"]."' ";
$query = mysqli_query($conn,$sql);
if($query) {
$message = "Update successful!";
echo "<script type='text/javascript'>alert('$message');</script>";
echo "<script>window.location='admin_page.php'</script>";
}
mysqli_close($conn);
?>
Tag : PHP
|
|
|
|
|
|
Date :
2019-10-08 14:05:51 |
By :
1757408174403891 |
View :
896 |
Reply :
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
คือจะสื่อว่ากด Save แล้วไม่ขึ้นอะไรเลยใช่ไหมครับ
ช่วยแก้ไขคำถามหน่อยครับตอนนี้ยัง งงๆ
แต่ถ้าอ่านจากโค๊ดผมก้รู้สึกแปลกๆไม่สอดคล้องกันยังไงไม่รู้
|
|
|
|
|
Date :
2019-10-08 14:21:23 |
By :
realizejoke |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ช่วยระบุด้วยครับว่าโค๊ดชุดบนกับล่างเป็นของหน้าไหน
|
|
|
|
|
Date :
2019-10-08 14:53:06 |
By :
realizejoke |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
พอรันออกมาแล้วเออเร่อเป็นตัวนี้ค่ะ ซึ่งแก้ไขตรงกันหมดแล้วนะคะ T^T
|
|
|
|
|
Date :
2019-10-09 22:21:53 |
By :
1757408174403891 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แก้ไขได้เรียบร้อยแล้วค่า ขอบคุณค่ะ
|
|
|
|
|
Date :
2019-10-10 00:43:41 |
By :
1757408174403891 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|