Чтение записей из таблицы базы данных MySQL
(файл index.php)
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Категории</title> </head> <body> <form method="post" action="add.php"> <table> <tr> <td>Название:</td> <td><input type="text" name="title" size='30' /></td> <td><input type="submit" name="submit" value="Создать" /></td> </tr> </table> </form> <br/> <table border="1"> <?php include("db.php"); $result = mysql_query("SELECT * FROM `m_category`"); if (!$result) die("Error: Data not found."); while($test = mysql_fetch_array($result)) { $id = $test['id']; echo "\n<tr>"; echo"<td><font color='black'>" .$test['title']."</font></td>"; echo"<td> <a href ='edit.php?id=$id'>Редактировать</a>"; echo"<td> <a href ='delete.php?id=$id'><center>Удалить</center></a>"; echo "</tr>"; } mysql_close($conn); ?> </table> </body> </html>