Ayuda, rellenado textbox
quien me da el codigo que me haga mostrar lo que contiene una bd en un textbox, la coneccion ya la tengo hecha, solo me falta lo que pido..porfavor, es urgente
suponiendo que ya te conectaste y ya tienes el resultado del sql
<?
do{
echo "<input name='el_texto' type='text' value=".$arreglo["campo"]." size='15' maxlength='15'>" ;
}while ($arreglo=mysql_fetch_array($resultado))
?>
Hay muchas formas de hacerlo
un echo dentro del value
value = <? echo $arreglo["campo"] ?>
etc
<?
do{
echo "<input name='el_texto' type='text' value=".$arreglo["campo"]." size='15' maxlength='15'>" ;
}while ($arreglo=mysql_fetch_array($resultado))
?>
Hay muchas formas de hacerlo
un echo dentro del value
value = <? echo $arreglo["campo"] ?>
etc
SALUD MEN
<body>
<h1><div align="center">Lectura de la tabla</div></h1>
<br>
<br>
<?
//Conexion con la base
mysql_connect("localhost","usuario","clave");
//Ejecutamos la sentencia SQL
$result=mysql_db_query("ejemplo","select * from clientes");
?>
<table align="center">
<tr>
<th>Nombre</th>
<th>Teléfono</th>
</tr>
<?
//Mostramos los registros
while ($row=mysql_fetch_array($result))
{
echo '<tr><td>'.$row["nombre"].'</td>';
echo '<td>'.$row["telefono"].'</td></tr>';
}
mysql_free_result($result)
?>
</table>
<div align="center">
<a href="insertar.html">Añadir un nuevo registro</a><br>
<a href="actualizar1.php">Actualizar un registro existente</a><br>
<a href="borrar1.php">Borrar un registro</a><br>
</div>
<body>
<h1><div align="center">Lectura de la tabla</div></h1>
<br>
<br>
<?
//Conexion con la base
mysql_connect("localhost","usuario","clave");
//Ejecutamos la sentencia SQL
$result=mysql_db_query("ejemplo","select * from clientes");
?>
<table align="center">
<tr>
<th>Nombre</th>
<th>Teléfono</th>
</tr>
<?
//Mostramos los registros
while ($row=mysql_fetch_array($result))
{
echo '<tr><td>'.$row["nombre"].'</td>';
echo '<td>'.$row["telefono"].'</td></tr>';
}
mysql_free_result($result)
?>
</table>
<div align="center">
<a href="insertar.html">Añadir un nuevo registro</a><br>
<a href="actualizar1.php">Actualizar un registro existente</a><br>
<a href="borrar1.php">Borrar un registro</a><br>
</div>
