Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $hostname="localhost";
- $username="";
- $password="";
- $database="chewvall_books";
- mysql_connect($hostname,$username,$password);
- @mysql_select_db($database) or die ("Unable to select database");
- $db_select=mysql_select_db(chewvall_books);
- if(!$db_select){
- die ("Could not connect to the database: <br />".mysql_error());
- }
- $query = "SELECT * FROM books NATURAL JOIN authors";
- $result = mysql_query( $query );
- if (!$result){
- die ("Could not query the database: <br />". mysql_error());
- }
- while ($result_row = mysql_fetch_row($result)){
- echo 'Title: '.$result_row[1] . '<br />';
- echo 'Author: '.$result_row[4] . '<br />';
- echo 'Pages: '.$result_row[2] . '<br />';
- }
- mysql_close();
- ?>
Add Comment
Please, Sign In to add comment