I am trying to execute a PHP/MySQL query to do the following for a single record:
- Find all column names that end in “_abc” in the users table
- Clear these fields for a single record (i.e. the user_id)
- Leave the data in the remaining columns alone
I have never done anything with database information schema before, so any help would be amazing!
Something like…?
$sth = $dbh->prepare("DESCRIBE users
WHERE column_name LIKE '_abc'
AND id = $user_id");
$sth->execute();
Then use the returned column names in an update statement