Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/12/2013, 09:08
Avatar de moriorGames
moriorGames
 
Fecha de Ingreso: diciembre-2013
Ubicación: Barcelona
Mensajes: 37
Antigüedad: 10 años, 3 meses
Puntos: 3
Respuesta: rellenar los input de un formulario en php y mysql

He pasado el código por Netbeans y me he dado cuenta de que había muchas cosas mal. Por ejemplo, no cierras los inputs, utilizas una conexión persistente que no necesitas, no printas bien las condiciones y un largo etc.

He modificado un poco el código a cómo lo haría yo, me da la sensación de que debería funcionarte tal y como te lo ponto, lo que pasa es que no lo puedo probar porque no tengo tu base de datos, efectivamente. ^^

Mira a ver si te sirve

Código PHP:
<?php
$id 
0;
if ( isset(
$_GET['id']) ) {
    
$id $_GET['id']; 
}

$link mysql_connect('localhost''root''');

if ( !
$link ) {
    die( 
'Error'mysql_error() ); 
}
mysql_select_db('bd',$link) or die(mysql_error()); 
$query "SELECT * FROM articles WHERE idt = $id";
$result mysql_query($query$link) or die(mysql_error());
?>
<table>
<?php while( $book mysql_fetch_array($result) ): ?>
    <tr> 
        <td>Id:</td> 
        <td><input type="text" name="isbn" value="<?php echo $id ?>" /></td> 
    </tr> 
    <tr> 
        <td>Título:</td> 
        <td><input type="text"  name="title" 
         value="<?php echo $book['title'?>" /></td></input> 
    </tr> 
    <tr> 
        <td>Precio:</td> 
        <td><input type="text" name="price" 
               value="<?php echo ($book['price'])? '' $book['price']; ?>" /></td> 
    </tr> 
    <tr> 
        <td>Descripción:</td> 
        <td><textarea rows=3 cols=50 
          name=description> 
          <?php echo ($book['description'])? '' $book['description']; ?>
          </textarea></td> 
    </tr> 
    <?php endwhile ?>
    <input type=image src="./imagenes/edit-iterm.jpg" width="25" height="15" />
</table>
__________________
Mi juego de estrategia medieval si lo entras hazme llegar tu opinión por favor, siempre la tengo en cuenta.