Hi, I have an error on my code and I have been attempting to solve it, but without success.
The error is Parse error: syntax error, unexpected T_ELSE in /homes/2011/abkg063/html/Coursework/includes/bookDetails.php on line 40
What should I do?
<?php
include "database.php";
print_r($_GET);
$id = $_GET['id'];
$query = "SELECT FROM Book, Publisher WHERE Book.publisher_id = Publisher.publisher_id AND Book.book_id=$id";
//$query = "SELECT FROM Book WHERE book_id=$id";
$query2 = "SELECT * FROM Author WHERE Author.author_id = Author.author_id=$id";
//print $query;
//print $abkg063->error;
// perform the query
$result = $abkg063->query($query);
if (mysql_num_rows($result)>0) { //nbre d'enregistrements retournés par $query
while ($row = $result->fetch_assoc()) {
echo "<h1>This works: $row[title]</h1>";
// second query
$result2 = $abkg063->query($query2);
if (mysql_num_rows($result2)>0) { //nbre d'enregistrements retournés par $query2
while ($row2 = $result2->fetch_assoc()) {
echo " <h1>This works:'$row2[author]'</h1> ";
} //end while for $row2
?>
<h2> this also works: <?php echo $row['title']?></h2>
<img src="/imgages/book_covers/<?php echo $row['book_id']?>.jpg" width=200 height=300 >
<?php
} //fin while pour $row
print_r($row2);
// Print out book details
echo "OK";
} else {
// No book found with such id
echo "NOT FOUND!";
}