Home » Php » Updating and new values in PostgreSQL

Updating and new values in PostgreSQL

Posted by: admin October 29, 2018 Leave a comment


I have written a script that insert new values into a table.

Now I would like to update the old values if they are changed and add new values. When I use the update PostgreSQL function, it doesn’t add the new values, it only updates the old values.

Do I have to use another function in PostgreSQL to add the new values too or do I have to change my query?

The update query code:

$sql = "UPDATE searchterms SET gene_id = '".$var_gene_id."', 
searchterm = '".$var_search_terms."', types = '".$var_type."' 
WHERE id = '".$var_id."' ";