vendredi 17 octobre 2014

PHP Form update MySql only if not null


Vote count:

0




Currently I have an update function that will update a row but if I leave one of the boxes empty, instead of not changing that value the value is deleted. If I only need to update one of the values, I would like to update this value and leave the other boxes blank. Is this possible?


Currently my code is this.



<?php
$key = $_POST['key'];
$value1 = $_POST['value1'];
$value2 = $_POST['value2'];
UPDATE table SET value1 = '$value1',value2 = '$value2' WHERE key = '$key';
?>


asked 4 mins ago

Tim

1






PHP Form update MySql only if not null

Aucun commentaire:

Enregistrer un commentaire