I have a page loaded into the database called showthumbs. On the page is a SQL statement that selects all thumbnails where category_id is $whatever. The page is named in the database "showthumbs". When you click on a link the link sends to the index page the name of the page to load (showthumbs)in the center and it sends a category_id, which is supposed to load the correct thumbnails for that category. However once the page content is loaded from the SQL section I think I need to reload that page to perform the SQL statement with the categoryID being the where clause. I hope this is making sense. Here is some code. I know this has to be possible.
My goal is to create a site that has all the page content stored in the database and I just call each page I need.
THIS IS THE CONTENT THAT IS LOADED INTO THE DATABASE, IT'S CALLED SHOWTHUMBS.
<?php require_once('Connections/testconnect.php');?>
<?php
//***********************************************************************************************
// Select from photo_table where photo_category = photo_category all thumbs 25 at a time.
//***********************************************************************************************
$maxRows_thumbscontent = 25;
$pageNum_thumbscontent = 0;
if (isset($_GET['pageNum_thumbscontent'])) {
$pageNum_thumbscontent = $_GET['pageNum_thumbscontent'];
}
$startRow_thumbscontent = $pageNum_thumbscontent * $maxRows_thumbscontent;
$colname_thumbscontent = "-1";
if (isset($_GET['photo_category'])) {
$colname_thumbscontent = (get_magic_quotes_gpc()) ? $_GET['photo_category'] : addslashes($_GET['photo_category']);
}
mysql_select_db($database_test, $test);
$query_thumbscontent = sprintf("SELECT * FROM photo_table WHERE photo_category = %s", $colname_thumbscontent);
$query_limit_thumbscontent = sprintf("%s LIMIT %d, %d", $query_thumbscontent, $startRow_thumbscontent, $maxRows_thumbscontent);
$thumbscontent = mysql_query($query_limit_thumbscontent, $test) or die(mysql_error());
$row_thumbscontent = mysql_fetch_assoc($thumbscontent);
if (isset($_GET['totalRows_thumbscontent'])) {
$totalRows_thumbscontent = $_GET['totalRows_thumbscontent'];
} else {
$all_thumbscontent = mysql_query($query_thumbscontent);
$totalRows_thumbscontent = mysql_num_rows($all_thumbscontent);
}
$totalPages_thumbscontent = ceil($totalRows_thumbscontent/$maxRows_thumbscontent)-1;
?>
<form name="form1" method="post" action="">
<table width="547" border="0">
<?php do { ?>
<tr>
<td width="36"><input name="thumbselect" type="radio" value="<?php echo $row_thumbscontent['photo_category']; ?>" onClick="document.forms['form1'].submit();"/></td>
<td width="209"><?php echo $row_thumbscontent['photo_thumb_name']; ?></td>
<td width="226"><?php echo $row_thumbscontent['photo_desc']; ?></td>
</tr>
<?php } while ($row_thumbscontent = mysql_fetch_assoc($thumbscontent)); ?>
</table>
</form>
HERE IS WHAT I USE TO CALL IT OUT OF THE DATABASE.
A link called index.php?photo_category=<?php echo $page_name;?>&show_cat=showthumbs
IT IS PULLING THE RADIO BUTTON ONTO THE INDEX SCREEN BUT BOTH VARIABLES ARE BLANK.
....Can someone give me some other suggestions or help me make this work.
Thanks in advance to everyone. And special thanks to those whov'e helped me before.
My goal is to create a site that has all the page content stored in the database and I just call each page I need.
THIS IS THE CONTENT THAT IS LOADED INTO THE DATABASE, IT'S CALLED SHOWTHUMBS.
<?php require_once('Connections/testconnect.php');?>
<?php
//***********************************************************************************************
// Select from photo_table where photo_category = photo_category all thumbs 25 at a time.
//***********************************************************************************************
$maxRows_thumbscontent = 25;
$pageNum_thumbscontent = 0;
if (isset($_GET['pageNum_thumbscontent'])) {
$pageNum_thumbscontent = $_GET['pageNum_thumbscontent'];
}
$startRow_thumbscontent = $pageNum_thumbscontent * $maxRows_thumbscontent;
$colname_thumbscontent = "-1";
if (isset($_GET['photo_category'])) {
$colname_thumbscontent = (get_magic_quotes_gpc()) ? $_GET['photo_category'] : addslashes($_GET['photo_category']);
}
mysql_select_db($database_test, $test);
$query_thumbscontent = sprintf("SELECT * FROM photo_table WHERE photo_category = %s", $colname_thumbscontent);
$query_limit_thumbscontent = sprintf("%s LIMIT %d, %d", $query_thumbscontent, $startRow_thumbscontent, $maxRows_thumbscontent);
$thumbscontent = mysql_query($query_limit_thumbscontent, $test) or die(mysql_error());
$row_thumbscontent = mysql_fetch_assoc($thumbscontent);
if (isset($_GET['totalRows_thumbscontent'])) {
$totalRows_thumbscontent = $_GET['totalRows_thumbscontent'];
} else {
$all_thumbscontent = mysql_query($query_thumbscontent);
$totalRows_thumbscontent = mysql_num_rows($all_thumbscontent);
}
$totalPages_thumbscontent = ceil($totalRows_thumbscontent/$maxRows_thumbscontent)-1;
?>
<form name="form1" method="post" action="">
<table width="547" border="0">
<?php do { ?>
<tr>
<td width="36"><input name="thumbselect" type="radio" value="<?php echo $row_thumbscontent['photo_category']; ?>" onClick="document.forms['form1'].submit();"/></td>
<td width="209"><?php echo $row_thumbscontent['photo_thumb_name']; ?></td>
<td width="226"><?php echo $row_thumbscontent['photo_desc']; ?></td>
</tr>
<?php } while ($row_thumbscontent = mysql_fetch_assoc($thumbscontent)); ?>
</table>
</form>
HERE IS WHAT I USE TO CALL IT OUT OF THE DATABASE.
A link called index.php?photo_category=<?php echo $page_name;?>&show_cat=showthumbs
IT IS PULLING THE RADIO BUTTON ONTO THE INDEX SCREEN BUT BOTH VARIABLES ARE BLANK.
....Can someone give me some other suggestions or help me make this work.
Thanks in advance to everyone. And special thanks to those whov'e helped me before.