I have a form that jQuery tracks the onChage .change()
event so when something is changed it runs a ajax request and i pass in the column, id, and the values in the url.
Here i have the PHP code that should update the data.
My question is now how do i build the mySQl string dynamically.
and how do i echo back the changes/updates that where just changed on the db.
Here is the PHP code i am trying to work with.
<?php require_once('Connections/connect.php'); ?>
<?php
$id = $_GET['id'];
$collumn = $_GET['collumn'];
$val = $_GET['val'];
?>
<?php
mysql_select_db($myDB, $connection);
// here i try to build the query string and pass in the passed in values
$sqlUpdate = 'UPDATE `plProducts`.`allPens` SET `$collumn` = '$val' WHERE `allPens`.`prodId` = '$id' LIMIT 1;';
// here i want to echo back the updated row (or the updated data)
$seeResults = mysql_query($sqlUpdate, $connection);
echo $seeResults
?>
is this example OK?
$sqlUpdate = 'UPDATE `plProducts`.`allPens` SET "{$collumn}" = "{$val}" WHERE `allPens`.`prodId` = "{$id}"LIMIT 1;';