Skip to content

Instantly share code, notes, and snippets.

@midnite81
Last active June 20, 2020 22:57
Show Gist options
  • Save midnite81/a38f97d4a72b10b7dfb17aebe1389963 to your computer and use it in GitHub Desktop.
Save midnite81/a38f97d4a72b10b7dfb17aebe1389963 to your computer and use it in GitHub Desktop.
An example of updating values where a column is not null
<?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