You see, this time I do not have a code, nor do I want to be given a code, but simply the idea.
I have a system of posts to which I want to add a button to give points (to the selected post). Good.
But how do I make those same points that I post the post to the user who posted the post. Something like a container.
Do I have to use two sql sentences? One to insert the points in the post field in the Bd and another one to insert it in the user's accumulated?
For easy to understand:
****Tabla usuario****
---- -------- ------ ---------
Id Nombre Apellidos Acumulado
---- ------- --------- ---------
1 Luis Tavarez 100
****Tabla posts****
---- ---------- -------- --------- ---------
Id_post Id_usuario Titulo Contenido Votos
---- ------- --------- --------- -------
2 1 Saludos Buenos días
As you can see, the votes field is zero, because nothing has been assigned yet. But if I assign, for example "10" points to that post, it would look like this:
**Tabla posts**
---- ---------- -------- --------- ---------
Id_post Id_usuario Titulo Contenido Votos
---- ------- --------- --------- -------
2 1 Saludos Buenos días 10
Then, the accumulated in the user table that has "100" accumulated points would summarize "10" more points and it would be like this:
****Tabla usuario****
---- -------- ------ ---------
Id Nombre Apellidos Acumulado
---- ------- --------- ---------
1 Luis Tavarez 110
In a few words all the points that are given to my posts are accumulated in the "Accumulated" field of the "user" table.