Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/07/2014, 05:50
alfuco
 
Fecha de Ingreso: julio-2014
Mensajes: 53
Antigüedad: 10 años, 4 meses
Puntos: 1
Respuesta: Borrar fila con condicion

Estoy bastante cerca de lograrlo, y para eso tengo una funcion que deberia hacerlo pero me salta este error: ( ! ) Fatal error: Call to undefined function borrarColumna() in C:\wamp\www\SIENS\admin\VistaPresupuestos(Pgmaestr a).php on line 133

Es raro porque llamo a la funcion correctamente... Os pongo el codigo:

<?php require_once('../Connections/localhost.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_localhost, $localhost);
$query_Recordset1 = "SELECT * FROM presupuestos";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $localhost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<!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" />
<title>Documento sin título</title>
<style type="text/css">
A {
border-radius: 8px;
text-decoration: none;
;
color: #FFF;
}

-->
.border {
border-radius: 8px;
}
.titulo {
color: #FFF;
font-weight: bold;
}
.datos {
color: #FFF;
}
</style>
</head>

<body>
<table border="0" align="center" cellpadding="10" cellspacing="2" id="tablita">
<tr bgcolor="#0000CC" class="titulo">
<td>Nombre</td>
<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
<td>Lengua source 1</td>
<td>Lengua source 2</td>
if($row_Recordset1['Lengua source 3'] !="") {
<td>Lengua source 3</td>
<td>Lengua target 1</td>
<td>Lengua target 2</td>
<td>Lengua target 3</td>
<script>
function borrarColumna(idTabla,numeroColumna)
{
var fila;
fila=document.getElementById(idTabla).getElementsB yTagName('tr');
ultimaColumna=fila.length
for(var i=0;i<ultimaColumna;i++)
fila[i].getElementsByTagName('td')[numeroColumna].style.display="none";
}
</script>

<?php } // Show if recordset not empty ?>
<td>Importe total</td>
</tr>
<?php do { ?>
<tr bgcolor="#0066FF" class="datos">
<td><a href="VistaPresupuestos.php?recordID=<?php echo $row_Recordset1['Nombre']; ?>"> <?php echo $row_Recordset1['Nombre']; ?>&nbsp; </a></td>

<td><?php echo $row_Recordset1['Lengua source 1']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['Lengua source 2']; ?>&nbsp; </td>
<td><?php if($row_Recordset1['Lengua source 3'] !="") {
echo $row_Recordset1['Lengua source 3'];}
else {borrarColumna('tablita',4);}
?>&nbsp; </td>

<td><?php echo $row_Recordset1['Lengua target 1']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['Lengua target 2']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['Lengua target 3']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['Importe total']; ?>&nbsp; </td>
<?php // Show if recordset not empty ?>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<br />
<table border="0">
<tr>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primero</a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Anterior</a>
<?php } // Show if not first page ?></td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Siguiente</a>
<?php } // Show if not last page ?></td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Último</a>
<?php } // Show if not last page ?></td>
</tr>
</table>
Registros <?php echo ($startRow_Recordset1 + 1) ?> a <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> de <?php echo $totalRows_Recordset1 ?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
</br></br>
<input type="button" value="Volver atrás" onClick="location.href='http://localhost/SIENS/IndiceVisualizador.html';" style="font-family: Verdana; font-size: 10 pt"/>