Questions tagged as 'mysql'

1
answer

If inside if MySQL

I'm doing a query on mysql and so far I have this SUM(IF(val1 IS NULL, val2, val1 )) AS total But is it possible to do something like that? SUM(IF(val1 IS NULL, if(val2 is null, 0, val2) val1 )) AS total Where I say that if val1...
asked by 04.10.2016 / 18:56
1
answer

Mysql Time Epoch subtract 4 hours

How do you spend 4 hours in a field that is in Time Epoch 1475638722 ? format I tried with DATE_SUB(field,INTERVAL 4 HOUR) but I did not get it.     
asked by 05.10.2016 / 05:46
1
answer

How to make records in the database with PHP?

This is the code I have made <?php $enlace = mysqli_connect("localhost", "root", "", "loteriav2"); if (!$enlace) { echo "Error: No se pudo conectar a MySQL." . PHP_EOL; echo "errno de depuración: " . mysqli_connect_errn...
asked by 28.08.2016 / 01:28
2
answers

script to support mysql databases in php, but I need to migrate to mysqli

<?php backup_tables('XXXXXXX','XXXXXXX','XXXXXXX','XXXXXXX'); /* backup the db OR just a table */ //En la variable $talbes puedes agregar las tablas especificas separadas por comas: //profesor,estudiante,clase //O déjalo con el asterisc...
asked by 27.08.2016 / 00:04
1
answer

add absence records

I have the following tables in a school attendance system: INASISTENCIA(idinasistencia,fecha,idtipoinassitencia,idalumno); TIPOINASISTENCIA(idtipoinasistencia,valor); How can I count the total value of a student's absence within a quarter?...
asked by 17.09.2016 / 22:24
1
answer

How to generate a query of two foreign keys that point to the same table?

I am developing a system to control X services, as I suppose I have a table called ' services ' where I keep all kinds of services, structurally the table is this: This table contains two fields called fidusuario_recepcion and fidu...
asked by 18.09.2016 / 05:37
1
answer

How to put condition in MySQL query

I have the following query that works the way it should. $result2 = mysql_query("SELECT * FROM datos WHERE intervalo in ($in) and fecha_hora >= '$dateini' AND fecha_hora <= '$datefin' and archivo in ($arch) and hora between $horain and $...
asked by 29.08.2016 / 22:53
1
answer

Modify and delete records from a PHP table

I have made the connection to my Database and I have a table that filters the records in real time with Ajax. I have added the delete and modify buttons but I can not make them work, I have tried several tutorials but most use Json. If anyone kn...
asked by 03.11.2016 / 05:43
1
answer

Generate .bat to execute SQL Server queries

I have the following series of questions: delete from OPENQUERY (MYSQL, 'SELECT * from clientes2 WHERE IDCliente>2') insert into OPENQUERY (MYSQL, 'SELECT IDCliente, Grupo, Codigo, Denominacion, CUIT, TipoCliente, Responsable1, Activo FROM...
asked by 03.11.2016 / 18:18
2
answers

Send email with MySQL information

As the question says I need to send an email with information obtained when executing a sentence ( Select * from for example) but I have no idea how to do this (my MySQL level is not very advanced), in MSSQL I would do it by a job and usi...
asked by 20.09.2016 / 18:05