Update uncomplicated

-2

Hello everyone, first of all, my question is the following ... on my site I have a visits system it works as follows

if (the visit does not exist) {

$ handle="takes the fields of the visit to the bank";

$ array = mysqli fetch array in cariavel handle

$ visit = $ array ['field name'] + 1;

$ changes an update in field visits with variable visit

define the visit session below }

My question is, would not it be some way to make an update more uncomplicated? ex:

$ visit = update visits set visits + 1

something like that? with only one query already amenta more number in my counter of visits, without needing to recover the fields to make a fetch array and only after the update, thank you already give for the help, happy new year to all of you !!

    
asked by anonymous 31.12.2017 / 03:06

1 answer

0

From what I think you just want to increment one in the variable visits, then it would be:

UPDATE table_name SET visitas = (visitas + 1) WHERE condicao
    
01.01.2018 / 18:53