Mi data Base
Código:
Ayuda a y mi code es esteCREATE TABLE `comments` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(128) collate utf8_unicode_ci NOT NULL default '', `url` varchar(255) collate utf8_unicode_ci NOT NULL default '', `email` varchar(255) collate utf8_unicode_ci NOT NULL default '', `body` text collate utf8_unicode_ci NOT NULL, `dt` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Código:
<?php //1. Crear conexión a la Base de Datos $conexion = mysql_connect("host", "admin", "mipass"); if (!$conexion) { echo 'Error'; } //2. Seleccionar la Base de Datos a utilizar $seleccionar_bd = mysql_select_db("mi data base", $conexion); if (!$seleccionar_bd) { echo 'error'; } $sql = mysql_query("SELECT * FROM comments"); $Total = mysql_num_rows($sql); ?> <table width="80%" border="1"> <?php if($Total<>0) { while ($reg = mysql_fetch_array($sql)) { ?> <tr> <td width="15%"><?php echo $reg['name']; ?></td> <td width="20%"><?php echo $reg['email']; ?></td> <td width="40%"><?php echo $reg['body']; ?></td> <td width="5%"><?php 'aqui qiero colocar el codigo para eliminar' ?></td> </tr> <?php } } else {}?> </table>