Skip to content
Home » How to update/edit data into database using PHP MySql | เรียนรู้การเขียนโปรแกรมออนไลน์ ที่เว็บไซต์

How to update/edit data into database using PHP MySql | เรียนรู้การเขียนโปรแกรมออนไลน์ ที่เว็บไซต์

คุณกำลังพยายามหาข้อมูลเกี่ยวกับหัวข้อการหาเงินออนไลน์หรือไม่? คุณกำลังมองหาหัวข้อที่เหมาะสม How to update/edit data into database using PHP MySql หรือไม่? ถ้าเป็นเช่นนั้นโปรดอ่านบทความนี้ทันที.

How to update/edit data into database using PHP MySql | update php.

[button color=”primary” size=”small” link=”#” icon=”” target=”false” nofollow=”true”]ดูวิดีโอโดยละเอียดด้านล่าง[/button]

รูปภาพที่เกี่ยวข้องกับหัวข้อ update php.

How to update/edit data into database using PHP MySql

How to update/edit data into database using PHP MySql

คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับ คู่มือการเขียนโปรแกรม ง่ายที่สุด ที่นี่: https://brokengroundgame.com/learn-to-program/.

ข้อมูลที่เกี่ยวข้องกับหัวข้อ update php.

ที่นี่.. อัปเดตข้อมูลเสร็จแล้ว.. ลงในฐานข้อมูล ..โดยใช้โค้ด PHP.. วิดีโอล่าสุดพร้อมคำอธิบายที่ชัดเจนในการแก้ไขข้อมูลอัปเดต ..

brokengroundgame.com หวังว่าข้อมูลในบทความนี้จะมีคุณค่ามากสำหรับคุณ. ขอแสดงความนับถือ.

การค้นหาที่เกี่ยวข้องกับหัวข้อHow to update/edit data into database using PHP MySql.

update php

how to update data into database in php,How to Update data in database using PHP MySQL,updata data into database in php,update data in database using php,update data in php,update data code in php,update data using php,update record in php mysqli,edit data in php,edit update data in database using php,update data using php mysql

#updateedit #data #database #PHP #MySql

How to update/edit data into database using PHP MySql

38 thoughts on “How to update/edit data into database using PHP MySql | เรียนรู้การเขียนโปรแกรมออนไลน์ ที่เว็บไซต์”

  1. im continously getting the message data not update?

    <html>

    <head>

    <title>update profile info</title>

    <style>

    body{

    background-color:whitesmoke;

    }

    input{

    width : 40%;

    height: 5%;

    border:1px;

    border-radius: 05px;

    padding : 8px 15px 8px 15px;

    margin: 10px 0px 15px 0px;

    box-shadow: 1px 1px 2px 1px grey;

    }

    </style>

    </head>

    <body>

    <center>

    <h1>Update Profile information</h1>

    <form action="" method="POST">

    <input type="text" name="id" placeholder="Enter Emp ID"/></br>

    <input type="text" name="username" placeholder="Enter user Name"/></br>

    <input type="text" name="email" placeholder="Enter Email ID"/></br>

    <input type="text" name="password" placeholder="Enter Passward"/></br>

    <input type="text" name="cpassword" placeholder="Enter conform password"/></br>

    <input type="submit" name="update" value="UPDATE Data"/>

    </form>

    </center>

    </body>

    </html>

    <?php

    $connection = mysqli_connect("localhost","root","");

    $db = mysqli_select_db($connection,'database');

    if(isset($_POST['update']))

    {

    $id = $_POST['id'];

    $username = $_POST['username'];

    $email = $_POST['email'];

    $password = $_POST['password'];

    $cpassword = $_POST['cpassword'];

    $query = "UPDATE users SET username='$username', email='$email', password='$password', WHERE id='$id' ";

    $query_run = mysqli_query($connection, $query);

    if($query_run)

    {

    echo '<script type = "text/javascript"> alert("Data Updated")</script>';

    }

    else

    {

    echo '<script type = "text/javascript"> alert("Data Not Updated")</script>';

    }

    }

    ?>

  2. Getting Data Not Updated may you tell whats wrong in the code?

    <!doctype html>

    <html lang="en">

    <head>

    <style>

    ul {

    list-style-type: none;

    margin: 0;

    padding: 0;

    width: 100px;

    background-color: black;

    }

    li a {

    display: block;

    color: white;

    padding: 8px 16px;

    text-decoration: none;

    }

    li a:hover {

    background-color: blue;

    color: white;

    }

    h1 {

    color: black;

    }

    </style>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"&gt;

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script&gt;

    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script&gt;

    </head>

    <title>admin</title>

    </head>

    <script>

    function createItem(name, description) {

    console.log()

    }

    </script>

    <body style="background-color:white">

    <h1>Admin Page</h1>

    <ul>

    <li><a href="adminpage.php">Home</a></li>

    <li><a href="edit_item.php">Edit</a></li>

    <li><a href="https://mail.google.com/mail/u/0/#inbox" target="_blank">E-mails</a></li>

    </ul>

    <div class="container">

    <div class="col-lg-4">

    <h2>Updating Database by PHP</h2>

    <form action="" name="form1" method="post">

    <div class="form-group">

    <label for="Product ID">Product ID</label>

    <input type="text" class="form-control" id="product_id" placeholder="Enter product id" name="product_id">

    </div>

    <div class="form-group">

    <label for="Product Type">Product Type</label>

    <input type="text" class="form-control" id="product_type" placeholder="Enter product type" name="product_type">

    </div>

    <div class="form-group">

    <label for="Item Name">Item Name</label>

    <input type="text" class="form-control" id="name" placeholder="Enter product name" name="name">

    </div>

    <div class="form-group">

    <label for="pwd">Item description</label>

    <input type="text" class="form-control" id="Description" placeholder="Enter item description" name="Description">

    </div>

    <div class="form-group">

    <label for="Image URL">Image URL</label>

    <input type="text" class="form-control" id="img_url" placeholder="Enter Image URL" name="img_url">

    </div>

    <div class="form-group">

    <label for="Price">Price</label>

    <input type="text" class="form-control" id="price" placeholder="Enter item price" name="price">

    </div>

    <div class="checkbox">

    <label><input type="checkbox" name="remember"> Remember me</label>

    </div>

    <button type="submit" name="update" class="btn btn-default">Update</button>

    <button type="submit" name="create" class="btn btn-default">Create</button>

    <button type="submit" name="delete" class="btn btn-default">Delete</button>

    </form>

    </div>

    </div>

    <div class="col-lg-12">

    </div>

    <?php

    $connection = mysqli_connect("localhost","root","");

    $db = mysqli_select_db($connection,'bit_academy');

    if(isset($_POST['update']))

    {

    $product_id = $_POST['product_id'];

    $query = "UPDATE products SET product_id='$_POST[product_id]',product_type='$_POST[product_type],name='$_POST[name]',Description='$_POST[Description]',img_url='$_POST[img_url]',price='$_POST[price]',' WHERE id='$_POST[product_id]' ";

    $query_run = mysqli_query($connection, $query);

    if ($query_run)

    {

    echo '<script type="text/javascript"> alert("Data Updated")</script>';

    }

    else

    {

    echo '<script type="text/javascript"> alert("Data Not Updated")</script>';

    }

    }
    ?>

    </body>

    </html>

  3. can you help me this

    <form action="updateuserprofile.php" method="POST">
    <div class="row">
    <div class="col-md-3">
    </div>
    <div class="col-md-3">
    <div class="form-group">
    <label class="bmd-label-floating">Full Name</label>
    <input type="text" name="name" class="form-control" required>
    </div>
    </div>
    <div class="col-md-4">
    <div class="form-group">
    <label class="bmd-label-floating"> Address</label>
    <input type="text" name="address" class="form-control" required>
    </div>
    </div>
    <div class="col-md-4">
    <div class="form-group">
    <label class="bmd-label-floating">Email Address</label>
    <input type="text" name="email" class="form-control" required>
    </div>
    </div>
    </div>
    <div class="row">
    <div class="col-md-6">
    <div class="form-group">
    <label class="bmd-label-floating">Contact Number</label>
    <input type="text" name="phonenumber" class="form-control" required>
    </div>
    </div>
    <div class="col-md-6">
    <div class="form-group">
    <label class="bmd-label-floating">Password</label>
    <input type="password" name="password" id="myInput" class="form-control" required>
    <input type="checkbox" onclick="myFunction()">Show Password
    </div>
    </div>
    </div>

    <div class="row">
    <div class="col-md-12">
    <div class="form-group">

    </div>
    </div>
    </div>
    <input type="submit" name="update" class="btn btn-primary pull-right" value="Update data" />
    <!– <button type="submit" name="update" class="btn btn-primary pull-right" value="UPDATE DATA">Update Profile</button> –>
    <div class="clearfix"></div>
    </form>

    <?php

    session_start();

    include "db_connect.php";

    if(isset($_POST['update'])){

    $name = $_POST['name'];

    $query = "UPDATE user SET id='$_POST[id]',name='$_POST[name]', address='$_POST[address]', phonenumber='$_POST[phonenumber]', email='$_POST[email]', password='$_POST[password]' WHERE name='$_POST[name]'";

    $query_run = mysqli_query($conn,$query);

    if ($query_run) {

    echo '<script>window.alert("UPDATED SUCCESSFULLY!!!!!")</script>';

    echo "<script>window.history.go(-1);</script>";

    }else{

    echo '<script>window.alert("ERROR!")</script>';

    }

    }

    ?>
    I always get the else echo ERROR

  4. You are god for me sir.. 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏 thousand thanks .. 🙏🙏🙏You saved me sir 😭😭😭😭

  5. useless video no benefit to me. Fetch the data from database then the fields will be filled with that data you fetch from database and then change it.

  6. please sir, help me.
    i already follow everything just like you did but it cannot update the data.

    <html>

    <head>

    <title> Update User Info</title>

    <style>

    body{

    backgroud-color:whitesmoke;

    }

    input {

    width:40%;

    height: 5%;

    border: 1px;

    border-radius: 05px;

    padding: 8px 15px 8px 15px;

    margin: 10px 0px 15px 0px;

    box-shadow: 1px 1px 2px 1px grey;

    }

    </style>

    </head>

    <body>

    <center>

    <h1> Updating User Info </h1>

    <form action="" method="POST">

    <input type="text" name="id" placeholder="Enter Your ID"/><br/>

    <input type="text" name="name" placeholder="Enter The Name"/><br/>

    <input type="text" name="material" placeholder="What Types of Material"/><br/>

    <input type="text" name="location" placeholder="Where is The Location"/><br/>

    <input type="submit" name="update" value="UPDATE DATA"/>

    </form>

    </center>

    </body>

    </html>

    <?php

    $connection = mysqli_connect("localhost", "root", "");

    $db = mysqli_select_db($connection,'booksystem');

    if (isset($POST['update']))

    {

    $id = $_POST['id'];

    $query = "UPDATE 'personalinfo' SET 'name'='$_POST[name]','material'='$_POST[material]' ,'location'='$_POST[location]'

    where id='$POST[id]' ";

    if($query_run)

    {

    echo '<script type="text/javascript"> alert("Data Updated") </script>';

    }

    else

    {

    echo '<script type="text/javascript"> alert("Data Not Updated") </script>';

    }

    }

    ?>

    i dont know where i get wrong

  7. Uncaught Error: Call to undefined function mysqli_connection(), how can i resolve it? im using xampp, i've done the database and ecc ecc, this error is from the index.php i have made, pls help me

Leave a Reply

Your email address will not be published. Required fields are marked *