0

Hello guys i wanna send two values from two queries to the other page Via GET Method the

one value is sending properly but the second is failing mean i am receiving just one value

but not the second one i need to use these two values in other page in a new query and

perform an action

Any one please?????

Here is my code:

    <?php
    require_once('db.php');
    if(isset($_POST['property']))
    {
    $property=$_POST['property'];
    $propertyquery = "SELECT PropertyID, PropertyImageID, PropertyName, PropertyStatus, PropertyLocation, PropertyRegion FROM properties WHERE PropertyImageID =$property";
     $propertyquery_run= mysql_query($propertyquery);
    if (mysql_num_rows($propertyquery_run) > 0) 
    {
        while ($propertyrow = mysql_fetch_array($propertyquery_run)) 
          {
        $imagequery ="SELECT PropertyImageID, ImagePath FROM propertyimages WHERE PropertyImageID='".$propertyrow['PropertyImageID']."' LIMIT 1";
         $imagequery_run=mysql_query($imagequery);        
    ?>
            <table style="margin-left:348px;">
    <tr><td>PropertyID:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo $propertyrow['PropertyID'] ?></span></td></tr><tr><td>PropertyName:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo $propertyrow['PropertyName'] ?></span></td></tr>
    <tr><td>PropertyStatus:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo $propertyrow['PropertyStatus'] ?></span></td></tr>
    <tr><td>PropertyLocation:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo $propertyrow['PropertyLocation'] ?></span></td></tr>
    <tr><td>PropertyRegion:</td><td><span style="color:#0F0; font-weight:bold;"><?php echo $propertyrow['PropertyRegion'] ?></span></td></tr>
            </table>
        <center>
    <?php }
                if(mysql_num_rows($imagequery_run) > 0)  
                {
                    while ($imagerow = mysql_fetch_array($imagequery_run))  
                    {
                    ?>
                       <div style="border:solid 2px #9F0; border-radius:5px; height:222px; width:544px;">

<!-- sending value started -->  

    <a href="DisplayImages.php?PropertyImageID=<?php echo $imagerow['PropertyImageID']     ?>&PropertyID=<?php echo $propertyrow['PropertyID'] ?>"> 



                       <img src="<?php echo $imagerow['ImagePath'];  ?>" width="544" height="222" ></a>    <!-- sending value Ended -->

                       </div><br />    
                    <?php
                    }

                }
            }
    }
    else
    {
        echo 'Go Back And Set Your Session.Thanks';
    }
    ?>
user2279037
  • 77
  • 2
  • 3
  • 9
  • What does the html that gets output look like? – Explosion Pills Apr 23 '13 at 04:58
  • nothing i have echo both values i am receiving one?????? – user2279037 Apr 23 '13 at 05:00
  • 3
    You asked the same question yesterday. Disk space for web servers is becoming costlier by the day.And its not even very energy efficient specially knowing yesterday was earth day. http://stackoverflow.com/questions/16140567/retrieving-data-from-two-tables-first-table-text-data-second-table-media-images – Hanky Panky Apr 23 '13 at 05:01
  • ya but prob is not solved yet ?????? – user2279037 Apr 23 '13 at 05:02
  • $propertyrow['PropertyID'] is not defined in your url because it is defined in top loop and may not use there so please store $propertyrow['PropertyID'] in top loop in a variable then use it. – Prince Apr 23 '13 at 05:02
  • sorry i am new to php by which method i should use it in top loop???? – user2279037 Apr 23 '13 at 05:06
  • Yesterday you wrote that it's working perfectly. Your question has the same problem as yesterday, you're ending the first loop too soon. The loops should be nested, not sequential. – Barmar Apr 23 '13 at 05:14
  • You are using [an **obsolete** database API](http://stackoverflow.com/q/12859942/19068) and should use a [modern replacement](http://php.net/manual/en/mysqlinfo.api.choosing.php). You are also **vulnerable to [SQL injection attacks](http://bobby-tables.com/)** that a modern API would make it easier to [defend](http://stackoverflow.com/questions/60174/best-way-to-prevent-sql-injection-in-php) yourself from. – Quentin Apr 23 '13 at 05:21
  • thanks alot sorry for stupid questions.... – user2279037 Apr 23 '13 at 05:21
  • you mean i should do my coding mysqli_...... like this ???? – user2279037 Apr 23 '13 at 05:22

1 Answers1

-1

may be this work check

<a href="DisplayImages.php?PropertyImageID=<?php echo $imagerow['PropertyImageID']; ?>&PropertyID=<?php echo $propertyrow['PropertyID']; ?>"> 

in above code for both echo's you missed ';'

deepi
  • 1,081
  • 10
  • 18