Ver Mensaje Individual
  #23 (permalink)  
Antiguo 22/04/2016, 03:38
ivan7
 
Fecha de Ingreso: abril-2016
Mensajes: 36
Antigüedad: 8 años, 1 mes
Puntos: 0
Respuesta: Hacer SUM correctamente

Cita:
Iniciado por xerifandtomas Ver Mensaje
Código PHP:
Ver original
  1. $resultado = mysqli_query($con,"SELECT SUM(Sueldo) AS Sueldo,
  2.                                             SUM(Antiguedad) AS Antiguedad,
  3.                                             SUM(Dif_Ant) AS Dif_Ant,
  4.                                             SUM(Turnicidad) AS Turnicidad,
  5.                                             SUM(C_Puesto) AS C_Puesto,
  6.                                             SUM(C_Niv_Retr) AS C_Niv_Retr,
  7.                                             SUM(C_Destino) AS C_Destino,
  8.                                             SUM(C_Prof_1) AS C_Prof_1,
  9.                                             SUM(C_Prof_2) AS C_Prof_2,
  10.                                             SUM(C_Prof_3) AS C_Prof_3,
  11.                                             SUM(C_Prof_4) AS C_Prof_4
  12.                                             FROM nomisferio") OR die("Error al ejecutar la consulta: ". mysqli_error($con));
Esta prueba es una de las que ya había probado, este es el error que me muestra utilizando esta sentencia:
Código HTML:
Ver original
  1. Fatal error: Function name must be a string in C:\wamp\www\sueldos\action_sueldos.php on line 31
La línea, o líneas, a la que se refiere son las siguienteS:
Código PHP:
Ver original
  1. $total = $row('Sueldo') + $row('Antiguedad') + $row('Dif_Ant') + $row('Turnicidad')
  2. + $row('C_Puesto') + $row('C_Niv_Retr') + $row('C_Destino') + $row('C_Prof_1')
  3. + $row('C_Prof_2') + $row('C_Prof_3') + $row('C_Prof_4');