justlukeyou Posted May 28, 2012 Share Posted May 28, 2012 Hi, I have a set of code which echoes content to create a product display and I have code for pagination however I am struggling to fit it together. This is the code for the I am trying to insert but it comes up with a T_STRING error. When I use this outside the pagination code it works fine. '<div class="productimageborder"><a href="product.php?price= echo $query_row['discount'] ; </div>' This is the code for the pagination <?php $per_page = 15; $pages_query = mysql_query("SELECT COUNT(`description`) FROM `productdbase`"); $pages = mysql_result($pages_query, 0); $pages = ceil(mysql_result($pages_query, 0) / $per_page); $page = (isset($_GET['page'])) ? (int)$_GET['page'] : 1; $start = ($page - 1) * $per_page; $query_string = "SELECT `description`, `price`, `awImage`, `awImage`, `discount` FROM `productdbase` LIMIT $start, $per_page"; $query = mysql_query($query_string); while ($query_row = mysql_fetch_assoc($query)) { echo '<p>', $query_row['description'] ,'</p>'; echo '<p>', $query_row['price'] ,'</p>'; echo '<p>', $query_row['awImage'] ,'</p>'; echo '<p>', $query_row['discount'] ,'</p>'; } if ($pages >= 1 && $page <= $pages) { for ($x=1; $x<=$pages; $x++) { echo ($x == $page) ? '<strong><a href="?page='.$x.'">'.$x.'</a></strong> ' : '<a href="?page='.$x.'">'.$x.'</a> '; } } ?> Link to comment https://forums.phpfreaks.com/topic/263278-putting-product-echo-and-pagination-together/ Share on other sites More sharing options...
wigwambam Posted May 28, 2012 Share Posted May 28, 2012 Try: echo '<div class="productimageborder"><a href="product.php?price=' . $query_row['discount'] . '</div>'; Link to comment https://forums.phpfreaks.com/topic/263278-putting-product-echo-and-pagination-together/#findComment-1349250 Share on other sites More sharing options...
justlukeyou Posted May 28, 2012 Author Share Posted May 28, 2012 Thanks, Adding CSS to this code seems incredibly senstive. Is there a reason why? For example I am trying to fit paginattion links into a DIV but it just creates an error. Link to comment https://forums.phpfreaks.com/topic/263278-putting-product-echo-and-pagination-together/#findComment-1349350 Share on other sites More sharing options...
justlukeyou Posted May 29, 2012 Author Share Posted May 29, 2012 Hi, I am struggling with adding CSS to the code. I have the pagination and I have the code to echo everything but putting it together makes it incredibly sensitive. Is there anyway to find out the right way to do. Is there a guide to syntax which is easy to follow or does anyone know the rules to it? Link to comment https://forums.phpfreaks.com/topic/263278-putting-product-echo-and-pagination-together/#findComment-1349578 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.