Foros del Web » Programando para Internet » PHP »

PHP OO consultas y modificacion de regisros dreamweaver

Estas en el tema de consultas y modificacion de regisros dreamweaver en el foro de PHP en Foros del Web. Hola ando recién me quiero reincorporar a esto que es php. hace mucho que no programo no programo ni diseño paginas y quisiera retomarlo. Últimamente ...
  #1 (permalink)  
Antiguo 30/06/2011, 20:42
Avatar de Fergusbra  
Fecha de Ingreso: mayo-2010
Ubicación: San Andrés Cholula, Puebla, Mexico, Mexico
Mensajes: 6
Antigüedad: 13 años, 11 meses
Puntos: 0
consultas y modificacion de regisros dreamweaver

Hola ando recién me quiero reincorporar a esto que es php. hace mucho que no programo no programo ni diseño paginas y quisiera retomarlo.
Últimamente he estado jugando con el dreamweaver cs5.
y he logrado ya conectar mi base de datos de mysql gracias a unos vídeo-tutoriales que encontrado.
Ya logre insertar registros en mi base de datos de manera exitosa y sin problemas.
no e podio generar consultas, ni modificaciones, ni eliminar datos.
los documentos que encontrado para realizar búsquedas me generan una tabla y no es lo que busco.

Dentro de mi base de datos tengo un campo que tiene el atributo de ser unico.

Mi intención es insertar en un pequeño formulario que incluya un cuadro de texto y un boton, un texto que refiera al campo que mencione anteriormente.

mi pregunta seria por ejemplo en la cuestión de modificar que tengo el formulario de actualización de registros¿como le hago para que me aparezcan los registros del campo único que introducí en el formulario anterior?

Gracias espero pueda alguien ayudarme
  #2 (permalink)  
Antiguo 30/06/2011, 22:37
Avatar de Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 15 años, 8 meses
Puntos: 2237
Respuesta: consultas y modificacion de regisros dreamweaver

Me permito invitarte a leer este tema, sigue las instrucciones del recuadro gris (lineas numeradas del 1 al 6) y habra mas posibilidades de ayudarte.
__________________
- León, Guanajuato
- GV-Foto
  #3 (permalink)  
Antiguo 01/07/2011, 03:05
Avatar de Uncontroled_Duck
Colaborador
 
Fecha de Ingreso: mayo-2011
Ubicación: Málaga [Spain]
Mensajes: 806
Antigüedad: 12 años, 11 meses
Puntos: 261
Respuesta: consultas y modificacion de regisros dreamweaver

Cita:
Iniciado por Triby Ver Mensaje
Me permito invitarte a leer este tema, sigue las instrucciones del recuadro gris (lineas numeradas del 1 al 6) y habra mas posibilidades de ayudarte.
Ademas de lo dicho arriba, puedes encontrar info al respecto aquí:
http://www.forosdelweb.com/wiki/Manu...icar_registros
Para esto.
Cita:
Iniciado por Fergusbra Ver Mensaje
...no e podio generar consultas, ni modificaciones, ni eliminar datos.
los documentos que encontrado para realizar búsquedas me generan una tabla y no es lo que busco.
...
Y para el tema de mostrar los resultados en el form.
http://www.forosdelweb.com/wiki/Manu...ularios#Inputs

La solución puede ser value""

Echa un vistazo, prueba, y si encuentras errores nos vas comentando para ir orientándote.

Saludos,
__________________
Todos agradeceremos que pongas el código en su respectivo Highlight
  #4 (permalink)  
Antiguo 01/07/2011, 21:32
Avatar de Fergusbra  
Fecha de Ingreso: mayo-2010
Ubicación: San Andrés Cholula, Puebla, Mexico, Mexico
Mensajes: 6
Antigüedad: 13 años, 11 meses
Puntos: 0
Respuesta: consultas y modificacion de regisros dreamweaver

ok. muchas gracias por los consejos!.
Tengo el código de mi botón buscar de la siguiente manera:
Código HTML:
<body>
<table width="100%" height="154" border="0">
  <tr>
    <td height="150">&nbsp;</td>
    <td><div align="center">MODIFICAR DATOS DE UN AMIGO</div></td>
    <td>&nbsp;</td>
  </tr>
</table>
<form name="input" action="amigosmodif1.php" method="get">
Introducrir la clave del amigo:
<input type="text" name="clave" />
<input type="submit" value="Buscar" />
</form>

</body> 
y en mi siguiente pagina llamada amigosmodif1.php tengo lo siguiente:
Código PHP:
<?php require_once('Connections/pruevamigo.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 amigos SET nombre=%s, apellidop=%s, apellidom=%s, direccion=%s, correo=%s WHERE clave=%s",
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['apellidop'], "text"),
                       
GetSQLValueString($_POST['apellidom'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['correo'], "text"),
                       
GetSQLValueString($_POST['clave'], "text"));

  
mysql_select_db($database_pruevamigo$pruevamigo);
  
$Result1 mysql_query($updateSQL$pruevamigo) or die(mysql_error());

  
$updateGoTo "amigomodif2.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$updateGoTo .= (strpos($updateGoTo'?')) ? "&" "?";
    
$updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$updateGoTo));
}

mysql_select_db($database_pruevamigo$pruevamigo);
$query_Recordset1 "SELECT * FROM amigos";
$Recordset1 mysql_query($query_Recordset1$pruevamigo) 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>
<table width="100%" height="214" border="0">
  <tr>
    <td height="210">&nbsp;</td>
    <td><div align="center">MODIFICAR DATOS DE UN AMIGO</div></td>
    <td>&nbsp;</td>
  </tr>
</table>

<p>&nbsp;</p>
<form action="<?php echo $editFormAction?>" method="post" name="form1" id="form1">
  <table align="center">
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Clave:</td>
      <td><?php echo $row_Recordset1['clave']; ?></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Nombre:</td>
      <td><input type="text" name="nombre" value="<?php echo htmlentities($row_Recordset1['nombre'], ENT_COMPAT'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Apellido paterno:</td>
      <td><input type="text" name="apellidop" value="<?php echo htmlentities($row_Recordset1['apellidop'], ENT_COMPAT'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Apellido materno:</td>
      <td><input type="text" name="apellidom" value="<?php echo htmlentities($row_Recordset1['apellidom'], ENT_COMPAT'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Direccion:</td>
      <td><input type="text" name="direccion" value="<?php echo htmlentities($row_Recordset1['direccion'], ENT_COMPAT'utf-8'); ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Correo:</td>
      <td><input type="text" name="correo" value="<?php echo htmlentities($row_Recordset1['correo'], ENT_COMPAT'utf-8'); ?>" 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="clave" value="<?php echo $row_Recordset1['clave']; ?>" />
</form>

</body>
</html>
<?php
mysql_free_result
($Recordset1);

mysql_free_result($Recordset1);
?>
No se como hacer para que la clave que escribo en amigosmodif sirva para buscar la clave en la tabla y me lo muestre a la pagina amigosmodif1.php y por ende me muestre los datos de ese amigo para modificaros...
gracias espero haberme explicado bien.
Estuve leyendo un poco y encontré algo de registrar la variable que me manda el formulario pero no estoy seguro de como hacerlo.

Etiquetas: mysql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:41.