Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    53
    Thanks
    5
    Thanked 0 Times in 0 Posts

    while loop displaying hyperlink[solved]

    i have a while loop displaying all of my product information and i want there to be an add to cart hyperlink displaying also, but keeps giving me a parsing error, i have tried many different combinations here is my code

    while($row = mysql_fetch_array($product_set)){



    echo "<p>";
    echo $row['product_name']."<br />";
    echo "$".$row['product_price']."<br />"."<br />";
    show_picture($row);
    ?>
    echo "<a href=\"shoppingcart.php?prod=".urlencode($row['product_id'])."?action=add\">"."</a>";
    <?php
    }

    am i doing something wrong?
    Last edited by swissbeets; 07-08-2008 at 04:30 PM.

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    You are breaking out of php with ?> and then trying to echo....take out the ?> and <?php before the }.

  • #3
    New Coder
    Join Date
    Jun 2008
    Posts
    53
    Thanks
    5
    Thanked 0 Times in 0 Posts
    when i do this nothing is displayed at all, it just skips right over that and shows the names, description and pictures

  • #4
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Because you don't have anything in the a tag:
    Code:
    echo "<a href=\"shoppingcart.php?prod=".urlencode($row['product_id'])."?action=add\">something here"."</a>";

  • #5
    New Coder
    Join Date
    Jun 2008
    Posts
    53
    Thanks
    5
    Thanked 0 Times in 0 Posts
    i knew it was something small thank you very much


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •