SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    linking to photo.php how to pass multiple querys

    hi all

    really having trouble trying to understand how i can link to a page with to diffrent querys?

    ok! i have photo.php which i wnat diffrent content to load depending on what gallery is chosen, but ive got diffrent querys, FROM photo WHERE gallery = 3'; on 1 link and say, FROM photo WHERE gallery = 26'; on another, to load into each div when a diffrent link is clicked.

    i no how to link with 1 query photo.php?link=galley05 but how can i get it to work with 2 or even 3????

    still learning so any info would be great, thanks!!! how would u do it???

    <div class="r">
    <div id="R1"> <!-- show gallery info-->
    PHP Code:
    <?php
    #make the query
    $sql "SELECT title, DATE_FORMAT(date, '%M %d, %Y') AS dr, photographer
    FROM photo_details WHERE gallery = 3"
    ;
        
    $result = @mysql_query ($sql)or die('Error: ' mysql_error());
        
    while (
    $row mysql_fetch_array ($result)) {
    echo 
    '<h2>' $row['title'] . '</h2><p>' $row['dr'] . '</p><p></p><p>Photographer: ' $row['photographer'] . '</p>';
        } 
        
    ?>
    <p>&nbsp;</p>
    </div>

    <div id="R2" class="clearfix"> <!-- show gallery -->
    PHP Code:
    <?php
    #make the query
    $sql 'SELECT photo_id, image
    FROM photo WHERE gallery = 3'
    ;
    $result2 = @mysql_query ($sql)or die('Error: ' mysql_error());
           
    for (
    $i 0$row mysql_fetch_array ($result2); $i++) { 
    if((
    $i != 0) and (($i 4) == 0)) 
    echo 
    '<br>'
                  
    echo 
    '<a href ="photos.php?photo_id='$row['photo_id'].'"> 
    <img src ="thumbs/'
    $row['image'] .'"></a>'
             

    ?>
    </div>

    thanks!!!!!
    Last edited by computerbarry; Aug 15, 2006 at 10:35.

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I don't really understand your question. Doesn't the approach you wrote work? It looks reasonable enough.
    Saul

  3. #3
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes it works, but i will have say 6-7 pages like this with diffrent querys relating to difrrent content in my database all loading into photos.php

    hope that helps !

    CHEERS!!

  4. #4
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so, your asking how to send 6-7 variables to photo.php, all at once?

    photo.php?var1=val1&var2=val2&var3=val3

  5. #5
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no i will have say, the 2 querys above which i want to pass to photo.php which are shown in certain parts of the page, but i will also have links with diffrent querys also wanting to get passed to photo.php, so each link will send a seprate 2 querys when its clicked to photo.php, if u get what i mean??

    photo.php

    link1 2 querys
    link2 2 querys
    link3 2 querys

    so each link will have diffrent content to show in photo.php

    how do i achive this (send the querys to photo.php) photo.php is my photo template and i just want to load in the diffrent content?

    THANKS!!!!!!!!

  6. #6
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how about you provide some sample html you wish the script to generate.

  7. #7
    SitePoint Wizard silver trophy
    Join Date
    Mar 2006
    Posts
    6,132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i dont really understand what you want. if you can provide some sample html output, maybe i can help. but otherwise, hopefully someone else understands you.


    btw, you can put html into the [php] tags. you dont need to break it up into a ton of blocks like that.

  8. #8
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok lets put it another way - quick example

    i have to querys like above which i want to pass or load in photo.php

    photo.php

    <body>
    blar blar blar

    <div id=#R1>
    PHP Code:
    <?php query 1 ?>
    </div>

    <div id=#R1>
    PHP Code:
    <?php query 2 ?>
    </div>

    so how do i send these to photo.php from a link?

    thanks for ur time, CHEERS!!!!!

  9. #9
    SitePoint Wizard
    Join Date
    Dec 2005
    Posts
    1,675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    another example, i have a similar page working with just 1 query basically calling the page into <div id="R1">

    the link ( photo.php?gallery=ma3 ) - but what can i apply to <div id="R2"> to call something else or is there an easyier way, and ma3.php is just 1 query which shows a no. of images from my database

    so really my link should look something like this ( photo.php?gallery=ma3&id=23 ) no?

    please help!!

    photo.php

    PHP Code:
    <div id="R1">
    <?php 

    $page 
    trim(addslashes($_GET['gallery'])); 
        if(
    $page == "i05"){ 
            include 
    "i05.php"
        } 
        elseif(
    $page == "ma3"){ 
            include 
    "ma3.php"
        }   
        else { 
            include 
    "default.php"
        } 
        
    ?>
        </div>
        
        <div id="R2" class="clearfix"> <!-- show gallery -->
                  ????????????????


        </div>
    thanks !!!


Bookmarks

Posting Permissions

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