Jump to content

Trying to display my products pulled from db in ordered lists


deansaddigh

Recommended Posts

OK so firstly heres the picture so you can see what it looks like.

 

Screenprint.jpg

 

obvioulsy i want them next to each other with the name above the image and the price underneath the image. for each product.

 

Heres my code

 

<?php echo'<ol>'?>
					<!-- Make the product name clickable and pass through its id -->
					<?php echo '<li class="newproducts"><a href="product_details.php?productid='.$productid.'">' .$productname.'</a></li>';?>

					<?php echo '<li class="newproducts">' .$row ['ProductPrice'].'</li>';?>

                        <?php echo '<li class="newproducts"><a href="'.$file.'" target="_blank" rel="lightbox"><img src="'.$file.'" width="100" height="100"/></li>';?>

					<?php '</li>'?>
					<?php '</ol>'?>

 

And here is my css

 

.newproducts
{
float:left;
}

 

Any help would be fantastic

Link to comment
Share on other sites

Firstly thanks very much for helping me.

 

How would i put the following code in on <li>

 

<?php echo'<ol>'?>
					<!-- Make the product name clickable and pass through its id -->
					<?php echo '<li class="newproducts"><a href="product_details.php?productid='.$productid.'">' .$productname.'</a><<br />';?>

                        <?php echo '<li class="newproducts"><a href="'.$file.'" target="_blank" rel="lightbox"><img src="'.$file.'" width="100" height="100"/></li><br /><br />';?>

					<?php echo '<li class="newproducts">' .$row ['ProductPrice'].'</li><br />';?>

					<?php '</li>'?>
					<?php '</ol>'?>

 

Could you possible write it for me if its not to much trouble

Link to comment
Share on other sites

i havent tested this, mainly because i cant but also because i beleive you could figure out simple errors yourself, looking at the code you posted that should produce parse errors but what the hey.

 

<ol>
    <!-- Make the product name clickable and pass through its id -->
    <li class="newproducts">
        <a href="product_details.php?productid="<?php echo($productid); ?>"><?php echo($productname); ?></a><br>
        <a href="<?php echo($file); ?>" target="_blank"rel="lightbox"><img src="<?php echo($file); ?>" width="100" height="100"/></a><br>
        <?php echo($row ['ProductPrice']); ?>
    </li>
</ol>

 

p.s. I edited it a few times, try that but you cant just come and ask every single time one little thing doesnt work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.