Simply increment the value that already exists in the database
$sql = "UPDATE member_profile SET points = points + 1 WHERE user_id = ?";
$db->prepare($sql)->execute([$userid]);
This code would work for both PDO and mysqli in the modern PHP versions
More Related Contents:
- Order results from two queries based on time in second query [closed]
- Query database then email posts from where user is subbed to
- Using PHP data in MySQL [closed]
- Save the data into a database and return another value from database using PHP
- Checking the availability of rooms
- How can I do ‘insert if not exists’ in MySQL?
- How to properly set up a PDO connection
- Getting raw SQL query string from PDO prepared statements
- Correct way to use LIKE ‘%{$var}%’ with prepared statements?
- MySQL Prepared statements with a variable size variable list
- Loading .sql files from within PHP
- PDO with INSERT INTO through prepared statements [closed]
- PHP MYSQL UPDATE if Exist or INSERT if not?
- MySQL “NOT IN” query 3 tables
- SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax — PHP — PDO [duplicate]
- Doing a while / loop to get 10 random results
- PHP – Import CSV file to mysql database Using LOAD DATA INFILE
- MYSQL Select from tables based on multiple rows
- How to execute raw queries with Laravel 5.1?
- Simple PHP SQL login troubleshooting
- Change date format (in DB or output) to dd/mm/yyyy – PHP MySQL
- MySql PHP select count of distinct values from comma separated data (tags)
- Laravel Eloquent get results grouped by days
- How to check if a value already exists to avoid duplicates?
- SELECT row by DATEPART()
- UNION syntax in Cakephp
- MYSQL select a piece of a string and order by that piece
- How do i search from serialize field in mysql database?
- PHP/MySQL Pagination
- Limit pagination page number