Ver Mensaje Individual
  #11 (permalink)  
Antiguo 05/04/2009, 12:30
hollowmanf
 
Fecha de Ingreso: enero-2009
Mensajes: 246
Antigüedad: 15 años, 3 meses
Puntos: 1
Respuesta: Problema con Update

A ver el script original es este:

list_records.php

Código PHP:
<?php
$host
="localhost"// Host name 
$username=""// Mysql username 
$password=""// Mysql password 
$db_name="test"// Database name 
$tbl_name="test_mysql"// Table name 

// Connect to server and select database.
mysql_connect("$host""$username""$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td>
<table width="400" border="1" cellspacing="0" cellpadding="3">
<tr>
<td colspan="4"><strong>List data from mysql </strong> </td>
</tr>

<tr>
<td align="center"><strong>Name</strong></td>
<td align="center"><strong>Lastname</strong></td>
<td align="center"><strong>Email</strong></td>
<td align="center"><strong>Update</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['name']; ?></td>
<td><? echo $rows['lastname']; ?></td>
<td><? echo $rows['email']; ?></td>

// link to update.php and send value of id 
<td align="center"><a href="update.php?id=<? echo $rows['id']; ?>">update</a></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table>
<?php
mysql_close
();
?>
El Id_cliente lo obtengo de la DB, soy novato en esto por eso al utilizar este tipo de script me complique, el tema es que no tengo mucha idea como para crearlo yo solo de 0, lo que estoy haciendo aqui es reemplazar los campos dependiendo de los datos que tengo en mi DB.

Salu2