php mysql update code example

Example 1: update php

//SQL query for updating php post from a form using sql
$firstName = $_POST['firstName'];
mysqli_query($con,"UPDATE member SET  firstName='$firstName' WHERE id=1");

or 
// actually updating php version
go contact hosting provider, or login to cpanl look for 'php' settings or 'MultiPHP Manager'

Example 2: live update mysql data in php

$(document).ready(function(){    
    loadstation();
});

function loadstation(){
    $("#station_data").load("station.php");
    setTimeout(loadstation, 2000);
}

Example 3: update php sql

$_old_username = "Randy";
$_new_username = $_POST["username"]; 

$_sql = "UPDATE user SET first_name = $_new_username WHERE first_name = $_old_username";

Tags:

Php Example