Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/01/2003, 10:37
xias
 
Fecha de Ingreso: enero-2002
Mensajes: 838
Antigüedad: 22 años, 4 meses
Puntos: 1
ahi va eso..

la verdad es q no se a q te referias, llevo muy poco tiempo en esto y no tengo nada de idea.

no se si sera esto lo q me pidas:

codigo php:

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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;
}

$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}

if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE aviso_tradicional SET tipo=%s, necesidades=%s, dia=%s, horario=%s, telf_contacto=%s, contacto=%s, obs=%s WHERE ID=%s",
GetSQLValueString($HTTP_POST_VARS['tipo'], "text"),
GetSQLValueString($HTTP_POST_VARS['necesidades'], "text"),
GetSQLValueString($HTTP_POST_VARS['dia'], "text"),
GetSQLValueString($HTTP_POST_VARS['horario'], "date"),
GetSQLValueString($HTTP_POST_VARS['telf_contacto'], "int"),
GetSQLValueString($HTTP_POST_VARS['contacto'], "text"),
GetSQLValueString($HTTP_POST_VARS['obs'], "text"),
GetSQLValueString($HTTP_POST_VARS['ID'], "int"));

mysql_select_db($database_aviso, $aviso);
$Result1 = mysql_query($updateSQL, $aviso) or die(mysql_error());
}

mysql_select_db($database_aviso, $aviso);
$query_Recordset1 = "SELECT * FROM aviso_tradicional";
$Recordset1 = mysql_query($query_Recordset1, $aviso) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);




codigo html:

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Tipo:</td>
<td>
<input type="text" name="tipo" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Necesidades:</td>
<td>
<input type="text" name="necesidades" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Dia:</td>
<td>
<input type="text" name="dia" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Horario:</td>
<td>
<input type="text" name="horario" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Telf_contacto:</td>
<td>
<input type="text" name="telf_contacto" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Contacto:</td>
<td>
<input type="text" name="contacto" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Obs:</td>
<td>
<input type="text" name="obs" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Update Record"></td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="ID" value="<?php echo $row_Recordset1['ID']; ?>">
</form>
<p>&nbsp;</p>
</body>
</html>


muchas gracias