Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2014, 11:29
Juanjo_pol
 
Fecha de Ingreso: octubre-2014
Mensajes: 14
Antigüedad: 10 años, 4 meses
Puntos: 1
Actualización código php

Buenas tardes, ya llevo un tiempo peleándome para actualizar el código php y normalmente me suele ir bien, no obstante he topado con un problema y no logro localizar el problema, ruego por si lo podéis revisar. Gracias

<?php
require("conexion.php");
require("funciones.php");

$idempresa = getParam($_GET["id"], "-1");
$action = getParam($_GET["action"], "");


//RESULTAT1


if ($action == "edit1") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat1 = sqlValue($_POST["resultat1"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat1=".$resultat1." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT1 l


//RESULTAT2


if ($action == "edit2") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat2 = sqlValue($_POST["resultat2"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat2=".$resultat2." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT2

//RESULTAT3


if ($action == "edit3") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat3 = sqlValue($_POST["resultat3"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat3=".$resultat3." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT3

//RESULTAT4


if ($action == "edit4") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat4 = sqlValue($_POST["resultat4"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat4=".$resultat4." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT4

//RESULTAT5


if ($action == "edit5") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat5 = sqlValue($_POST["resultat5"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat5=".$resultat5." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT5

//RESULTAT6


if ($action == "edit6") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat6 = sqlValue($_POST["resultat6"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat6=".$resultat6." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT6

//RESULTAT7


if ($action == "edit7") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat7 = sqlValue($_POST["resultat7"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat7=".$resultat7." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT7

//RESULTAT8


if ($action == "edit8") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat8 = sqlValue($_POST["resultat8"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat8=".$resultat8." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT8

//RESULTAT9


if ($action == "edit9") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat9 = sqlValue($_POST["resultat9"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat9=".$resultat9." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT9

//RESULTAT10


if ($action == "edit10") {
$idempresa = sqlValue($_POST["id"], "int");

$resultat10 = sqlValue($_POST["resultat10"], "text");


$sql = "UPDATE empresa SET ";
$sql.= "resultat10=".$resultat10." ";
$sql.= "WHERE id=".$idempresa;
$mysqli->query($sql, $conexion);
header("location: RESULTADO.php");
}


//FIN RESULTAT10


$sql = "SELECT * FROM empresa WHERE id = ".sqlValue($idempresa, "int");
$queEmp = $mysqli->query($sql,$conexion);
$rsEmp = $queEmp->fetch_array(MYSQLI_ASSOC);
$total = mysqli_num_rows($queEmp);
if ($total == 0) {
header("location: listado.php");
exit;
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />



<p>
<label for="data">DATA</label>
<input name="data" type="text" id="data" value="<?php echo $rsEmp["data"]; ?>" />
<br />
<label for="torn">TORN</label>
<input name="torn" type="text" id="torn" value="<?php echo $rsEmp["torn"]; ?>" />
</p>
<p>&nbsp;</p>

<table width="1000" border="1">

<tr>
<td><label for="agents1">AGENT:</label><br>
<input type="text" id="agents1" name="agents1" value="<?php echo $rsEmp["agents1"]; ?>" /></td>
</tr>
<tr>

<form method="post" id="frEmpresa" action="editar.php?action=edit1">
<table width="1000" border="1">
<td> <label for="resultat1">RESULTAT</label><BR>
<textarea name="resultat1" cols="130" rows="10" id="resultat1"><?php echo $rsEmp["resultat1"]; ?></textarea>
<BR>
<label for="bts">&nbsp;</label>
<button type="submit">Guardar</button>
<input type="hidden" id="id" name="id" value="<?php echo $rsEmp["id"]; ?>" />
</td>
</tr>
</table>
</form>

Y aquí vendría el resto...