I'm trying create a site that, when you .click using multiple, linked tables. (Comicsmain is the main table, the writer table has information on multiple writers, publisher has publishers, artist has artist names, etc)
For example:
When you click on a page that says publisher, it shows the names of the publisher and the number of database entries that are under that publisher. When you click on the link that says more information, it should bring up information on all of the books by that publisher from the main table (comicsmain) From there, it should let you click on a specific book, and show you all the information on that specific book.
However, I can't get past the step of displaying how many books are published by which publsiher.
When the link is pressed it says to check an error in mySQL syntax near "
Here is the code for my publisher page minus the css, :
CODE
<?php
mysql_select_db($database_firsttry, $firsttry);
$query_Recordset1 = "SELECT comicsmain.publisher, publisher.name, count(publisher.name), comicsmain.price FROM publisher RIGHT OUTER JOIN comicsmain ON publisher.id=comicsmain.publisher GROUP BY name ASC";
$Recordset1 = mysql_query($query_Recordset1, $firsttry) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php do { ?>
<?php echo $row_Recordset1['name']; ?>
<?php echo $row_Recordset1['count(publisher.name)'];?>
<a href="detail.php?id=%20<?php echo $row_recordset1['id']; ?>">More information</a>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
<?php mysql_free_result($Recordset1);
?>
and here is the code for the detail page that follows. (also minus the css)
CODE
<?php
$colname_Recordset1 = "1";
if (isset($HTTP_GET_VARS['id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['id'] : addslashes($HTTP_GET_VARS['id']);
}
mysql_select_db($database_firsttry, $firsttry);
$query_Recordset1 = sprintf("SELECT comicsmain.titles, publisher.name, comicsmain.images FROM comicsmain INNER JOIN publisher ON publisher.id=comicsmain.publisher WHERE publisher.id=%s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $firsttry) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php do { ?>
<a href="info.php?id=<?php echo $row_Recordset1['id']; ?>"><img src="<?php echo $row_Recordset1['images']; ?>" border="0" /></a><br />
<?php echo $row_Recordset1['titles']; ?> <?php echo $row_Recordset1['Name']; ?>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>