CREATE TABLE `clients` ( `idcustom` int (100) NOT NULL AUTO_INCREMENT, `name` varchar (255) DEFAULT NULL, `domicile varchar (255) DEFAULT NULL, `telefono` varchar (50) DEFAULT NULL, `province` varchar (255) DEFAULT NULL, `city` varchar (255) DEFAULT NULL, `email` varchar (255) DEFAULT NULL, PRIMARY KEY (`clientname`), KEY `clientname` (` customername`) ) ENGINE = MyISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT = 1;
// server connection $ link = mysql_connect ('localhost', 'user', 'password'); if (! $ link) { die ('Not connected:'. mysql_error ()); } //database if (! mysql_select_db ('dbclientes')) { die ('Can \' t use foo: '. mysql_error ()); }
<? include ('config.php'); echo "<table border = 1>"; echo "<tr>"; echo "<td> <b> CustomerID </ b> </ td>"; echo "<td> <b> Name </ b> </ td>"; echo "<td> <b> Address </ b> </ td>"; echo "<td> <b> Phone </ b> </ td>"; echo "<td> <b> Province </ b> </ td>"; echo "<td> <b> City </ b> </ td>"; echo "<td> <b> Email </ b> </ td>"; echo "</ tr>"; $ result = mysql_query ("SELECT * FROM` clients` ") or trigger_error (mysql_error ()); while ($ row = mysql_fetch_array ($ result)) { foreach ($ row AS $ key => $ value) {$ row [$ key] = stripslashes ($ value); } echo "<tr>"; echo "<td valign = 'top'>". nl2br ($ row ['idcliente']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['name']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['address']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['phone']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['province']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['city']). "</ td>"; echo "<td valign = 'top'>". nl2br ($ row ['email']). "</ td>"; echo "<td valign = 'top'> <a href=edit.php?id={$row['id']}> Edit </a> </ td> <td> <a href = delete.php? id = {$ row ['id']}> Delete </a> </ td> "; echo "</ tr>"; } echo "</ table>"; echo "<a href=new.php> New Row </a>"; ?>
Most popular questions within the last 30 days