Ver Mensaje Individual
  #5 (permalink)  
Antiguo 20/04/2011, 13:42
Avatar de cuervo699
cuervo699
 
Fecha de Ingreso: febrero-2011
Mensajes: 104
Antigüedad: 13 años, 2 meses
Puntos: 7
Respuesta: Problema con version Mysql...

Código PHP:
<?php require_once('Connections/bd_panel_control.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;
}
}

$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 perfiles WHERE Institucion=%s",
                       
GetSQLValueString($_POST['Institucion'], "text"));

  
mysql_select_db($database_bd_panel_control$bd_panel_control);
  
$Result1 mysql_query($updateSQL$bd_panel_control) or die(mysql_error());
}

mysql_select_db($database_bd_panel_control$bd_panel_control);
$query_Recordset1 "SELECT * FROM perfiles";
$Recordset1 mysql_query($query_Recordset1$bd_panel_control) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 mysql_num_rows($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>
</head>

<body>
<form action="<?php echo $editFormAction?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Institucion:</td>
      <td><input type="text" name="Institucion" value="<?php echo $row_Recordset1['Institucion']; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">&nbsp;</td>
      <td><input type="submit" value="Actualizar registro" /></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1" />
  <input type="hidden" name="Institucion" value="<?php echo $row_Recordset1['Institucion']; ?>" />
</form>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result
($Recordset1);
?>
Ese es el codigo PHP

Con respecto a lo que me dijiste, ya lo comienzo a entender un poco...

Pero el codigo que me diste es para hacer un registro predeterminado, por ejemplo si en mi perfil mi institucion es Instituto CPECH y quiero modificarla a travez de un campo de texto para usuarios... no con algo predeterminado

me explico???