Wrox Programmer Forums
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 4th, 2007, 02:38 PM
Registered User
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default PHP Styling

Hi, I'm fairly new at PHP and am in the process of creating an online shop complete with shopping cart. I have put some code together which lists all my categories in a "menu" type way but I would like to know how to sytle these links as they look bland and not as good as my plain html ones. Also, when the category is clicked, I am trying to get it to load a picture as well as giving description and price. At present I only get description and price and no picture but I can't see why. The piece of code is:

                $get_cats = "select id, cat_desc from Category order by id";
$get_cats_res = mysql_query($get_cats) or die(mysql_error());

if (mysql_num_rows($get_cats_res) < 1) {
   $display_block = "<P><em>Sorry, no categories to browse.</em></p>";
} else {
   while ($cats = mysql_fetch_array($get_cats_res)) {
        $cat_id = $cats[id];
        $cat_desc = stripslashes($cats[cat_desc]);

        $menu_block .= "<p><strong><a href=\"$_SERVER[PHP_SELF]?cat_id=$cat_id\">$cat_desc</a></strong></p>";

        if ($_GET[cat_id] == $cat_id) {
           //get Product
           $get_Product = "select id, item_slogan, item_price, item_image from Product where cat_id = $cat_id order by item_slogan";
           $get_Product_res = mysql_query($get_Product) or die(mysql_error());

           if (mysql_num_rows($get_Product_res) < 1) {
                $display_block = "<P><em>Sorry, no items in this category.</em></p>";
           } else {
                $display_block .= "[list]";

                while ($Product = mysql_fetch_array($get_Product_res)) {
                   $item_id = $Product[id];
                   $item_slogan = stripslashes($Product[item_slogan]);
                   $item_price = $Product[item_price];
                   $item_image = $Product[item_image];

                   $display_block .= "<li><a href=\"showitem.php?item_id=$item_id\">$item_sloga n</a></strong> (£$item_price)";

                $display_block .= "</ul>";
Does any one have any ideas please?

Thank you.

Old April 10th, 2007, 05:10 AM
Friend of Wrox
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts

Not sure what you mean but I think you want to style the hyperlink tags
<a href="http://www.somesite.com">some site</a>
If this is what you want to style you should use CSS.
The same goes for list styles

__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Controls and Styling robzyc ASP.NET 2.0 Basics 4 July 8th, 2008 05:39 AM
Styling pie charts in SSRS 2005 Dangermouse BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 0 February 20th, 2007 07:28 AM
Nav Bar Styling VictorVictor BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 May 16th, 2006 06:02 PM
XSLT and styling jacob XSLT 4 October 13th, 2005 02:50 AM
Error: movie.php & commit.php on p182-186, ch6 willburke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 October 12th, 2004 02:48 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.