I've been experimenting using PHP and SQL to access a database to then be able to read and append to it.
My problem is that, however I set it out when I compared different ways to structure it. It doesn't update.
$sql = "UPDATE Test SET '$updateGet' = '$appendGet' WHERE id = '$idGet'" ;
What is the correct way without worrying about SQL injection? Also, any documentation on other ways to do this would be appreciated.
<?php
$servername = "localhost";
$username = "jenk3194";
$password = "wlFfn1";
$dbname = "jenk3194";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
$appendGet = ($_GET["appendSend"]); # WHAT TO APPEND
$idGet = ($_GET["idSend"]); # ID TO APPEND
$updateGet = ($_GET["updateSend"]); # WHAT TO UPDATE
#$sql = "UPDATE Test SET Projection = 999 WHERE id = 1";
$sql = "UPDATE Test SET '.$updateGet.' = '.$appendGet.' WHERE id = '.$idGet.'" ;
#$sql= sprintf("UPDATE Test SET %s = %d WHERE id = %d", $updateGet, $appendGet, $idGet);
echo $sql;
?>