ajax - Trying to build a dynamic PHP mysql_query string to update a row and getting back the updated row -


I have a form that tracks jQuery's onChage .change () event When something changes, it runs an Ajax request and I value in the column, id, and url.

Here I have PHP code that should update the data

My question is now how do I make mySQl string dynamically? And how do I resonate that change / update, where there was a change on DB

Here is the PHP code with which I am trying to work.

  & lt;? Php require_once ('Connection / Connect.fp'); ? & Gt; & Lt ;? Php $ id = $ _GET ['id']; $ Collumn = $ _GET ['Column']; $ Val = $ _GET ['val']; ? & Gt; & Lt ;? Php mysql_select_db ($ myDB, $ connection); // Here I try to pass the query string and pass in the passed values ​​of $ sqlUpdate = 'UPDATE `plProducts` .allPens` SET` $ collumn` =' $ val 'where' all pages' .Prudid` = $ 'ID' LIMIT 1; '; // Here I want to resize the update line (or updated data) $ view = mysql_query ($ sqlUpdate, $ connection); Result $ watch result? & Gt;  

Is this example okay?

  $ sqlUpdate = 'UPDATE `plProducts`.' 'All pens set' {$ collumn} "=" {$ val} "WHERE` All pages '.product =" {$ id} "range1;';  

string combination operator .

  $ sqlUpdate = 'UPDATE' Plproducts`. '' Alpin 'set` $ column.' '= \' $ Val \ 'where' all pages '. ProdID ='. $ Id 'range1;' mysql_query (mysql_escape_string ($ SQLUpdate));  

Of course, it presents a complete framework of deficiencies.


Comments