what is wrong with this code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nwebhosting
    New Member
    • Oct 2006
    • 23

    what is wrong with this code

    I click on a image on textimage20.php
    It takes me to text4.php but it all displays is:

    SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.imag e_id, dollsimage.imag e_date, doll.pricetype, prices.pricetyp e, prices.priceval ue FROM dollsimage, doll, prices WHERE doll.pricetype = prices.pricetyp e and dollsimage.imag e_id = '123' and doll.gameandtoy name = '123' and doll.bigdescrip tion = '123'

    Then I see the border, an X in there for the image
    And then $0.00

    Thank you for any help.

    This is my code:


    Textimage20.php


    [HTML]
    [PHP]
    echo '<TD> <a href="http://localhost/text4.php?image _id=123"> <img border="1" height="90" width="100"
    src="imagedolls .php?act=view&i id=' . $row['image_id'] . '"> </a> ' '</TD>' ;
    [/PHP]
    [/HTML]


    text4.php :

    [HTML]
    [PHP]
    $id = $_GET['image_id'];

    $sql = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.imag e_id, dollsimage.imag e_date, doll.pricetype, prices.pricetyp e, prices.priceval ue
    FROM dollsimage, doll, prices
    WHERE doll.pricetype = prices.pricetyp e and dollsimage.imag e_id = '$id' and doll.gameandtoy name = '$id' and doll.bigdescrip tion = '$id'
    ");
    echo "$sql <br>";



    $row = mysql_fetch_arr ay($result);

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

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

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

    [/PHP]
    [/HTML]
  • Velhari
    New Member
    • Sep 2006
    • 46

    #2
    Originally posted by nwebhosting
    I click on a image on textimage20.php
    It takes me to text4.php but it all displays is:

    SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.imag e_id, dollsimage.imag e_date, doll.pricetype, prices.pricetyp e, prices.priceval ue FROM dollsimage, doll, prices WHERE doll.pricetype = prices.pricetyp e and dollsimage.imag e_id = '123' and doll.gameandtoy name = '123' and doll.bigdescrip tion = '123'

    Then I see the border, an X in there for the image
    And then $0.00

    Thank you for any help.

    This is my code:


    Textimage20.php


    [HTML]
    [PHP]
    echo '<TD> <a href="http://localhost/text4.php?image _id=123"> <img border="1" height="90" width="100"
    src="imagedolls .php?act=view&i id=' . $row['image_id'] . '"> </a> ' '</TD>' ;
    [/PHP]
    [/HTML]


    text4.php :

    [HTML]
    [PHP]
    $id = $_GET['image_id'];

    $sql = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.imag e_id, dollsimage.imag e_date, doll.pricetype, prices.pricetyp e, prices.priceval ue
    FROM dollsimage, doll, prices
    WHERE doll.pricetype = prices.pricetyp e and dollsimage.imag e_id = '$id' and doll.gameandtoy name = '$id' and doll.bigdescrip tion = '$id'
    ");
    echo "$sql <br>";



    $row = mysql_fetch_arr ay($result);

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

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

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

    [/PHP]
    [/HTML]
    Hi,
    I think the mistake made by you is you didn't include the following statement in your code, if this is included means it might been successfull to you

    [PHP]$result = mysql_query($sq l);[/PHP]

    With Regards,
    Velmurugan.H

    Comment

    • nwebhosting
      New Member
      • Oct 2006
      • 23

      #3
      I do have the statement : $result = mysql_query ($sql, $conn);

      Here is the code again


      textimage20.php :


      [HTML]
      [PHP]
      echo '<TD> <a href="http://localhost/text4.php?image _id=123"> <img border="1" height="90" width="100"
      src="imagedolls .php?act=view&i id=' . $row['image_id'] . '"> </a> ';

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

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

      [/HTML]
      [/PHP]

      text4.php :

      [[HTML]
      [PHP]
      <?php


      $id = $_GET['image_id'];

      $sql = ("SELECT gameandtoyname, pricevalue, bigdescription, dollsimage.imag e_id, dollsimage.imag e_date, doll.pricetype, prices.pricetyp e, prices.priceval ue
      FROM dollsimage, doll, prices
      WHERE doll.pricetype = prices.pricetyp e and dollsimage.imag e_id = '$id' and doll.gameandtoy name = '$id' and doll.bigdescrip tion = '$id'
      ");
      echo "$sql <br>";

      $result = mysql_query ($sql, $conn);

      if (!$result) {
      die('Invalid query: ' . mysql_error());
      }



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


      $row = mysql_fetch_arr ay($result);

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

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

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


      [/PHP]
      [/HTML]


      ?>





      Originally posted by Velhari
      Hi,
      I think the mistake made by you is you didn't include the following statement in your code, if this is included means it might been successfull to you

      [PHP]$result = mysql_query($sq l);[/PHP]

      With Regards,
      Velmurugan.H

      Comment

      • khalidbaloch
        New Member
        • Oct 2006
        • 61

        #4
        try by removing this line from text4.php

        echo "$sql <br>";

        mysql select statment is being printed out in html

        good luck and take care

        Comment

        Working...