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 4 of 4

Thread: click on image.

  1. #1
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    click on image.

    Hi and thanks for any help.

    I am not sure of all i need to make this works:

    I have a page textimage20.php It prints 6 images from a table dollsimage and some information from table doll.

    Now i need the link to click any of this images and take me to text4.php page and display the same image from dollsimage table and some extra information from doll table.

    What SELECT should be in text4.php so the id brings dollsimage.image_id,
    the gameandtoyname and the extra nformation :bigdescription


    This is my link and SELECT in textimage20.php:

    [HTML]
    PHP Code:
    <?php

    $sql 
    = ("SELECT gameandtoyname, pricevalue, dollsimage.image_id, dollsimage.image_date, dolls.pricetype, prices.pricetype, prices.pricevalue
               FROM dollsimage, dolls, prices
               WHERE dollsimage.image_id = dolls.image_id and dolls.pricetype = prices.pricetype
               ORDER BY image_date DESC LIMIT $from, $max_results"
    );
     
       
    $result mysql_query ($sql$conn);
      
       if (!
    $result) {
       die(
    'Invalid query: ' mysql_error());



    echo 
    '<TD>  <a href="http://localhost/text4.php"> <img border="1" height="90" width="100" 
    src="imagedolls.php?act=view&iid=' 
    $row['image_id'] . '"> </a>  '

    echo 
    '<BR>' .$row['gameandtoyname'] ;


    $row['pricevalue'] = number_format($row['pricevalue'],2'.''');
    echo 
    '<br>';
    echo 
    '$' .$row['pricevalue'].  '</TD>';;
          
    ?>
    [/HTML]

  • #2
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Code:
    SELECT gameandtoyname, dollsimage.image_id, bigdescription
               FROM dollsimage, dolls, prices
               WHERE dollsimage.image_id = '$_GET['iid']'
               ORDER BY image_date DESC LIMIT $from, $max_results

    Something like that

  • #3
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi and thanks.

    Now i get this error:
    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Online Services\Apache2\htdocs\text4.php on line 24

    line 24:
    $sql = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.image_id, dollsimage.image_date, doll.pricetype, prices.pricetype, prices.pricevalue
    FROM dollsimage, doll, prices
    WHERE doll.pricetype = prices.pricetype and dollsimage.image_id = '$_GET['iid']' and doll.gameandtoyname = '$id' and doll.bigdescription = '$id'
    ");


    I did add the GET in text4.php like this:


    [HTML]
    PHP Code:
    <?php


       $sql 
    = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.image_id, dollsimage.image_date, doll.pricetype, prices.pricetype, prices.pricevalue
               FROM dollsimage, doll, prices 
               WHERE doll.pricetype = prices.pricetype and dollsimage.image_id = '$_GET['iid']' and doll.gameandtoyname = '$id' and doll.bigdescription = '$id'
               "
    );
     echo 
    "$sql <br>";
     
       
    $result mysql_query ($sql$conn);
      
       if (!
    $result) {
       die(
    'Invalid query: ' mysql_error());







    echo 
    "<TABLE BORDER=\"1\">\n";


         
    $row mysql_fetch_array($result);
       
       echo 
    '<TD>   <img border="1" height="90" width="100" 
    src="imagedolls.php?act=view&iid=' 
    $row['image_id'] . '">  '

    echo 
    '<BR>' .$row['gameandtoyname'] ;
    echo 
    '<BR>' .$row['bigdescription'] ;

    $row['pricevalue'] = number_format($row['pricevalue'],2'.''');
    echo 
    '<br>';
    echo 
    '$' .$row['pricevalue'].  '</TD>';
          


    ?>
    [/HTM]

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I think you just need to concatenate the variable because it is an associative array.

    Try the code below.

    PHP Code:
    <?php


       $sql 
    = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.image_id, dollsimage.image_date, doll.pricetype, prices.pricetype, prices.pricevalue
               FROM dollsimage, doll, prices 
               WHERE doll.pricetype = prices.pricetype and dollsimage.image_id = '"
    .$_GET['iid']."' and doll.gameandtoyname = '".$id."' and doll.bigdescription = '".$id."'
               "
    );
     echo 
    "$sql <br>";
     
       
    $result mysql_query ($sql$conn);
      
       if (!
    $result) {
       die(
    'Invalid query: ' mysql_error());







    echo 
    "<TABLE BORDER=\"1\">\n";


         
    $row mysql_fetch_array($result);
       
       echo 
    '<TD>   <img border="1" height="90" width="100" 
    src="imagedolls.php?act=view&iid=' 
    $row['image_id'] . '">  '

    echo 
    '<BR>' .$row['gameandtoyname'] ;
    echo 
    '<BR>' .$row['bigdescription'] ;

    $row['pricevalue'] = number_format($row['pricevalue'],2'.''');
    echo 
    '<br>';
    echo 
    '$' .$row['pricevalue'].  '</TD>';
          


    ?>


  •  

    Posting Permissions

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