Last active
June 20, 2020 22:57
-
-
Save midnite81/a38f97d4a72b10b7dfb17aebe1389963 to your computer and use it in GitHub Desktop.
An example of updating values where a column is not null
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// you should be escaping the values you pass to the SQL query | |
if (! empty($first_name)) { | |
$sql = "UPDATE `user` SET `u_first` = $first_name WHERE `id`='$uid' and u_first IS NOT NULL;"; | |
// execute etc .. | |
} | |
// then you will need to do the same for the other fields | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment