Questions tagged as 'mysql'

2
answers

Avoid a concurrent insert

I have a problem on my website. It turns out that I have a packs table which has a availability column. A pack will be available as long as the availability is > 0 . A user can reserve an available pack, upon payment with Stripe. This...
asked by 03.04.2018 / 23:09
2
answers

fix the date of the previous day at 00:00 hours

I need to get MySQL the date of the previous day at 00:00 hours. For example if today is 21/11/2017 11:57:00 , the resulting date should be% 20/11/2017 0:00:00.000 . In sybase I take it out this way SELECT dateadd (dd, 0,conv...
asked by 21.11.2017 / 12:18
1
answer

duplicate message when executing stored procedure

How can I avoid duplicate results on the screen when I execute a stored procedure? This is the procedure: CREATE PROCEDURE 'my_procedure'() BEGIN declare fecha_aux varchar(30); set fecha_aux = Date_format(now(),'%M %d %Y %h:%i:%s %p...
asked by 24.11.2017 / 13:51
1
answer

Perform update of later and previous dates

I have a table called TABLE_ENTREGAS with 4 fields id fecha_entrega fecha_preparacion fecha_facturacion Where fecha_entrega is a data already inserted I call it with a variable $fecha_entrega it contains a data in datetime:...
asked by 21.09.2017 / 13:28
1
answer

Repeated rows in MYSQL query

Good I have a problem, it turns out that I have 3 tables that contain information about the event, another with the 'materials' (services) for that event and an intermediate table that generates me the N to N, when I want to show the event with...
asked by 21.12.2017 / 04:56
2
answers

Error showing list with PDO

Hello I'm trying to show a list which showed me with 'myslqi' now I'm working with PDO but I can not make it work the error that generates me I do not understand it. function listadoUsuarios(){ $db = new BaseDatos(); $db->conectar()...
asked by 14.03.2018 / 11:54
1
answer

Multiplication and sum in MySql or php

I need to perform the following operation of the following table in mysql or php: I need to calculate unit_value by quantity (unit_value * amount) and add all the values when the nonreceiver is equal to 11 (where no_recibo = 11). I n...
asked by 06.09.2017 / 04:50
1
answer

Error knowing if a MySQL table is empty

I have the following php code and it does not detect me if there is a record in the table or not and I do not know what it can be: $server = "localhost"; $user = "root"; $pass = ""; $bd = "crypto4all"; //Creamos la conexión $conexion = mysqli...
asked by 14.05.2018 / 20:35
2
answers

Assignment of several data to a single primary key?

Good morning, my question is this, can I give several assignments to a primary key? At this moment I am making a database for an exercise of my university and I wanted to give several assignments to a single primary key but to the time to make t...
asked by 13.05.2018 / 08:15
2
answers

MySQL - Conditional average in grouped data

I am new in this field and I fall short in trying to solve what I want. In a table imported from excel I have the columns <grado, docente, curso, Nota1, Nota2, Nota3, Nota4, Nota5> some fields belonging to the notes contain an "X",...
asked by 15.08.2017 / 23:32