Questions tagged as 'sql-update'

1
answer

Invert value 0 or 1 in a column

I have a table that has many records and a column called posição . It only receives the value 0 for blocked and 1 for released. Now with a precise change, invert these values, where this has to be 1 and where this 1 has to be 0. H...
asked by 11.04.2015 / 01:14
2
answers

Update the information on the page when making a change in the DB

Let's say I have button value="+1" on my page, and every time I click on this button an update is made to the database, the page refreshes and displays a message of success or error. This update process is simple! Only when returning from...
asked by 02.06.2015 / 04:19
1
answer

How to update the value of a column through substitution in all rows of the table?

I have a i18n table in the database whose constant column contains all values with the prefix lang : Table description ┌──────────────┬──────────────┬──────┬────────┬─────────────────────┬────────────────┐ │ Field...
asked by 31.12.2013 / 15:11
3
answers

How to do that, if the registry exists, it does update, if it does not make an insert of the same one

I'm a beginner in the forum and in php and I have a question. I have a table with id auto_increment and name is primary key. It has like me to do IF and ELSE using UPDATE and INSERT. Where, if there is name just do update, otherwise do insert?...
asked by 21.09.2017 / 20:16
1
answer

Add value to SQL table instead of replacing

Using the following code: UPDATE 'login' SET diasvip = '".+$_POST["qntvip"]."' WHERE userid = '".$_POST["userid"]."' When I run, it replaces the diasvip with the posted value instead of adding the value to those already in the table....
asked by 07.03.2015 / 15:40
3
answers

How to perform UPDATE with ORDER BY on sql server?

I would like to perform an update ordering the results of it, so I wanted to run an update like this: UPDATE pessoa SET nome = 'Jose' WHERE sobrenome LIKE '%Betalla%' ORDER BY nome But when I try to perform this update, an incorrect syntax...
asked by 29.02.2016 / 19:53
2
answers

UPDATE giving error but updates database

IamcreatingaloginpagewhereIneedtowritetotheMySQLdatabasethedateandtimetheuserwasloggedin.InthedatabaseIhaveatablesomethinglikethis:____________________________________________________|nome|login|senha|login_on|----------------------------------...
asked by 22.07.2016 / 21:42
1
answer

Condition of a query with a subquery

I need to update the last 110 records of the relevo table, however my problem is in the subquery in WHERE . I'm doing it this way: UPDATE relevo SET id_projeto = 157 WHERE id_relevo = (SELECT id_relevo FROM relevo ORDER BY id_...
asked by 09.09.2018 / 00:50
1
answer

What is the cost of an update when it can not find the record?

I'm doing some SQL queries in my Delphi program and I had this doubt, what is the cost to the database engine when a UPDATE does not find the record according to the parameters of WHERE ? My question came from the need to make som...
asked by 09.03.2018 / 22:18
1
answer

CRUD PHP Do not update and give no error

I'm having problems when I try to run an UPDATE on my system in PHP + MySQL. I have the file code edit: <?php require_once 'init.php'; // resgata os valores do formulario $nome = isset($_POST['nome']) ? $_POST['nome']: null; $nasciment...
asked by 02.01.2017 / 22:34