Cita:
Iniciado por loncho_rojas
No te preocupes, nadie te robara el codigo, hay muchos de esos por aca... y cuando me refiero a codigo, es algo mas que una simple consulta SQL
jejeje no, no es por que me vayan a copiar el codigo, solo que no lo tenia en la compu en ese momento, pero aki les va.
Código PHP:
<?php require_once('Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE padron SET folio=%s, calle=%s, num_int=%s, encalles=%s, colonia=%s, colindancias=%s, inmueble=%s, nombreprop=%s WHERE cuenta=%s",
GetSQLValueString($_POST['folio'], "text"),
GetSQLValueString($_POST['calle'], "text"),
GetSQLValueString($_POST['num_int'], "text"),
GetSQLValueString($_POST['encalles'], "text"),
GetSQLValueString($_POST['colonia'], "text"),
GetSQLValueString($_POST['colindancias'], "text"),
GetSQLValueString($_POST['inmueble'], "text"),
GetSQLValueString($_POST['nombreprop'], "text"),
GetSQLValueString($_POST['cuenta'], "text"));
mysql_select_db($database_conexion, $conexion);
$Result1 = mysql_query($updateSQL, $conexion) or die(mysql_error());
}
?>
este viene siendo ya con el dreamweaber, con el pequeño asistente que trae para realizar las actualizaciones, aunque aqui tengo otro, que me sucede exactamente lo mismo.
Código PHP:
<?php
// Recupera ID del proveedor
$cuenta = strtoupper($_REQUEST["cuenta"]);
$folio = $_REQUEST["folio"];
$calle = $_REQUEST["calle"];
$numero=$_REQUEST["numero"];
$encalles=$_REQUEST["encalles"];
$colonia=$_REQUEST["colonia"];
$colindancias=$_REQUEST["colindancias"];
$inmueble=$_REQUEST["inmueble"];
$ocupacion=$_REQUEST["ocupacion"];
$agua=$_REQUEST["agua"];
$drenaje=$_REQUEST["drenaje"];
$regagua=$_REQUEST["regagua"];
$regdrenaje=$_REQUEST["regdrenaje"];
$tarifa=$_REQUEST["tarifa"];
$categoria=$_REQUEST["categoria"];
$condiciones=$_REQUEST["condiciones"];
$toma=$_REQUEST["toma"];
$sanitarios=$_REQUEST["sanitarios"];
$mingitorios=$_REQUEST["mingitorios"];
$regaderas=$_REQUEST["regaderas"];
$lavabos=$_REQUEST["lavabos"];
$tinas=$_REQUEST["tinas"];
$fregaderos=$_REQUEST["fregaderos"];
$lavaderos=$_REQUEST["lavaderos"];
$lavadoras=$_REQUEST["lavadoras"];
$boilers=$_REQUEST["boilers"];
$albercas=$_REQUEST["albercas"];
$aire=$_REQUEST["aire"];
$fuentes=$_REQUEST["fuentes"];
$llaves=$_REQUEST["llaves"];
$medidor=$_REQUEST["medidor"];
$numedidor=$_REQUEST["numedidor"];
$lugmedidor=$_REQUEST["lugmedidor"];
$funciona=$_REQUEST["funciona"];
$lectura=$_REQUEST["lectura"];
$nombreprop=$_REQUEST["nombreprop"];
$apellido=$_REQUEST["apellido"];
$conyugue=$_REQUEST["conyugue"];
$nivel=$_REQUEST["nivel"];
$electricidad=$_REQUEST["electricidad"];
$satelite=$_REQUEST["sateilite"];
$cable=$_REQUEST["cable"];
$asfalto=$_REQUEST["asfalto"];
$descuento=$_REQUEST["descuento"];
$tipodescuento=$_REQUEST["tipodescuento"];
$observaciones=$_REQUEST["observaciones"];
function Conectarse()
{
if (!($link=mysql_connect("localhost","root")))
{
echo "Error conectando a la base de datos.";
exit();
}
if (!mysql_select_db("jmas",$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
$link=Conectarse();
echo "Conexión con la base de datos conseguida.<br>";
// Realiza la actualización del proveedor indicado
$strqry = "UPDATE padron SET folio='$folio', calle='$calle',"."numero='$numero', encalles='$encalles',"." colonia='$colonia', colindancias='$colindancias',"."inmueble='$inmueble', ocupacion='$ocupacion',"."agua='$agua', drenaje='$drenaje',"." regagua='$regagua', regdrenaje='$regdrenaje',"."tarifa='$tarifa', categoria='$categoria',"."condiciones='$condiciones', toma='$toma',"."sanitarios='$sanitarios', mingitorios='$mingitorios',"."regaderas='$regaderas', lavabos='$lavabos',"."tinas='$tinas', fregaderos='$fregaderos',"."lavaderos='$lavaderos', lavadoras='$lavadoras',"."boilers='$boilers', albercas='$albercas',"."aire='$aire', fuentes='$fuentes',"."llaves='$llaves', medidor='$medidor',"."numedidor='$numedidor',lugmedidor='$lugmedidor',"."funciona='$funciona', lectura='$lectura', nombreprop='$nombreprop',"."apellido='$apellido',conyugue='$conyugue',"."nivel='$nivel',electricidad='$electricidad',"."satelite='$satelite', cable='$cable',"."asfalto='$asfalto', descuento='$descuento',"."tipodescuento='$tipodescuento',observaciones='$observaciones',"." WHERE cuenta=$cuenta";
$qry = mysql_query ($strqry);
if (!$qry || (mysql_affected_rows()==0))
print ('<font color="#ff0000" size="4" face="Verdana, Arial, Helvetica, sans-serif">
<strong>Error : Actualización Fallida.</strong></font>');
else{
print ('<font color="#999999" size="4" face="Verdana, Arial, Helvetica, sans-serif">
<strong>Aviso : Proveedor actualizado exitosamente.</strong></font>
<font color="#006699" size="2" face="Verdana, Arial, Helvetica, sans-serif">
<br><br>Verifique las modificaciones
<a href="http://localhost/ITC-DISCLI/Ejemplos/php_mysql_2.php">
utilizando el Ejemplo 2</a>
</font> ');
}
// Cierra la conexión con MySQL
mysql_close ($link);
?>