Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- booklist.php -->
- <?php
- $dbuser='root';
- $dbpass='your_mysql_root_password';
- $dbhost='localhost';
- $conn=mysql_connect($dbhost, $dbuser, $dbpass);
- if (!$conn) die("<h3><font color=red>You must install MySQL.</font></h3>");
- $db_selected=mysql_select_db("books", $conn);
- if (!$db_selected)
- {
- print("<h3><font color=red>Database does not exist.</font></h3>");
- }
- else
- {
- $r = mysql_query("SELECT * FROM book_table", $conn);
- }
- if (!$r)
- {
- print("<h3><font color=red>book_table does not exist.</font></h3>");
- }
- else
- {
- print("<h2><font color=Blue>Books in your_name Library</font></h2>
- <table border>
- <tr><b><Th>ID<Th>Author</Th><Th>Title</Th><Th>Publisher</Th><Th>Year</Th><Th>Pages</Th><Th>Category</Th><Th>Date read</Th><Th>Evaluation</Th><Th>Location</Th></b></tr>");
- while ($row = mysql_fetch_array($r))
- {
- print("<tr><td>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td>$row[6]</td><td>$row[7]</td><td>$row[8]</td><td>$row[9]</td>");
- }
- }
- print("</table>");
- mysql_close($conn);
- print("<p></p>");
- print("<a href=index.htm>Return</a> to menu.");
- print('</center>');
- ?>
Add Comment
Please, Sign In to add comment