UPDATE klient SET (n_srok_v = '$_POST['n_srok_v']', n_1_1='$_POST['n_1_1']' ) WHERE xxx==1; xxx - auto increment
UPDATE `klient` SET n_srok_v = '$_POST['n_srok_v']', n_1_1='$_POST['n_1_1']' WHERE xxx=1; Equal sign "=" In general, I recommend using placeholders so that there is no $_POST['n_srok_v'] such things in the query. Firstly, it is unsafe, most likely you are now making such a request a hole for active XSS , and secondly, it is poorly readable.
UPDATE klient SET n_srok_v = '$_POST["n_srok_v"]', n_1_1='$_POST["n_1_1"]' WHERE xxx=1;
Focus on quotes and a single equal sign. Yes, and when inserting this request in php, you have to escape some of the quotes.
Another option is possible:
UPDATE klient SET n_srok_v = '{$_POST['n_srok_v']}', n_1_1='{$_POST['n_1_1']}' WHERE xxx=1; It is advisable to process more input data.
UPDATE klient SET n_srok_v = '.mysql_real_escape_string($_POST['n_srok_v']).', n_1_1='.mysql_real_escape_string($_POST['n_1_1']).' WHERE xxx=1; It is possible so for example :) And in fact, @karbachinsky is right, it is better to check the data transmitted by post / gett, so that later it would not be excruciatingly painful.
Specifically this request:
mysql_query("UPDATE klient SET n_srok_v = ".$_POST["n_srok_v"].", n_1_1 = ".$_POST["n_1_1"]." WHERE xxx=1"); To quickly find errors, even in the process of writing, using editors, I can advise phpdesinger paid, 30 days are free. The key can be bought or not))
name )) otherwise it will swear at the wrong quotes again. - DemoriaNYou can try this option.
$n_srok_v = $_POST['n_srok_v']; $n_1_1 = $_POST['n_1_1']; $sql = "UPDATE klient SET n_srok_v = '" . $n_srok_v . "', n_1_1 = '" . $n_1_1 . "' WHERE xxx=1"; Source: https://ru.stackoverflow.com/questions/35275/
All Articles