mysqli update or create code example

Example 1: mysql update query

UPDATE table_name SET field1 = 'value 1', field2 = 'value 2'
WHERE field3 = 'value 3'

Example 2: mysqli procedural UPDATE

if ($db->query("UPDATE contact SET lastname='Doe' WHERE id=2") === TRUE) {
  echo "Record updated successfully";
} else {
  echo "Error updating record";
}

Example 3: live update mysql data in php

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

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

Tags:

Css Example