SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Link Reading 3 Different Rows?

    Hi,

    I have been trying to complete a multi-dimensional array. The idea is that someone can click on 1 of 3 skills. I have tried to insert the skills and User ID into its own table. However I still cant create a link which reads all 3 skills.

    Does anyone have any suggestions as to how I can create a link which reads 3 different rows?


    Skill1: Web Design User ID: 17
    Skill2: Graphic Design User ID: 17
    Skill3: SEO Marketing User ID: 17


    eventskillsquery.php?skill= Reads skill1 / skill2 or skill3

  2. #2
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by justlukeyou View Post
    Hi,
    Skill1: Web Design User ID: 17
    Skill2: Graphic Design User ID: 17
    Skill3: SEO Marketing User ID: 17
    HTML Code:
    http://myDomain.com/links.php?id=17&sk1=Web+Design&sk2=Graphic+Design&sk3=SEO+Marketing
    Denny Schlesinger
    web services

  3. #3
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    But I am confused how this would work.

    I want to echo the three skills seperately.

    Or could I still do this...

    Code:
    http://myDomain.com/links.php?id=17&sk1=Web+Design&sk2=Graphic+Design&sk3=SEO+Marketing >Web Design</a>
    
    http://myDomain.com/links.php?id=17&sk1=Web+Design&sk2=Graphic+Design&sk3=SEO+Marketing >Graphic Design</a>

  4. #4
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by justlukeyou View Post
    Thanks,

    But I am confused how this would work.

    I want to echo the three skills seperately.
    To do them separately you might use
    HTML Code:
    <a http://myDomain.com/links.php?id=17&sk=Web+Design>Web Design</a>
    <a http://myDomain.com/links.php?id=17&sk=Graphic+Design>Graphic Design</a>
    <a http://myDomain.com/links.php?id=17&sk=SEO+Marketing>SEO+Marketing</a>
    Note that there are now only two arguments id and sk instead of four id, sk1, sk2, sk3.
    Denny Schlesinger
    web services

  5. #5
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    That it what I am trying to do.

    But how do I make 'sk' read Skill1,Skill2 and Skill3?

  6. #6
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by justlukeyou View Post
    Thanks,

    That it what I am trying to do.

    But how do I make 'sk' read Skill1,Skill2 and Skill3?
    That's an entirely different question and the answer depends on how your data is organized. Is it in a file? Is it in a database? How is it mapped to memory (variables)? You need to start from the structure of the data.
    Denny Schlesinger
    web services

  7. #7
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Its just in a table like this:



    Skill1: Web Design User ID: 17
    Skill2: Graphic Design User ID: 17
    Skill3: SEO Marketing User ID: 17
    Skill1: Catering User ID: 18
    Skill2: Food Production User ID: 18
    Skill3: Qualified Chefs User ID: 18

    There is also another row with the hyphen in.

  8. #8
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by justlukeyou View Post
    Hi,

    Its just in a table like this:



    Skill1: Web Design User ID: 17
    Skill2: Graphic Design User ID: 17
    Skill3: SEO Marketing User ID: 17
    Skill1: Catering User ID: 18
    Skill2: Food Production User ID: 18
    Skill3: Qualified Chefs User ID: 18

    There is also another row with the hyphen in.
    I'm still not clear on the organization of the data. If the user has a record with

    id, skill1, skill2, skill3

    to access the right record and the right column you would use something like
    PHP Code:
    $sql "SELECT id, '$skill' AS skill
              FROM table
             WHERE ID = '
    $id'"
    The link has to return the two data '$skill' and '$id'. The links would be:
    HTML Code:
    <a http://myDomain.com/links.php?id=17&sk=skill1>Skill 1 or some other text</a>
    <a http://myDomain.com/links.php?id=17&sk=skill2>Skill 2</a>
    <a http://myDomain.com/links.php?id=17&sk=skill3>Skill 3</a>
    The php to do the transformation:
    PHP Code:
    <?php
    $skill 
    $_GET['sk'];
    $id $_GET['id'];
    $sql "SELECT '$skill' AS skill
              FROM table
             WHERE id = '
    $id'";
    ?>

    There is also another row with the hyphen in.
    I don't understand what this means.
    Denny Schlesinger
    web services

  9. #9
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    This is what I have so far so I insert the skill 1 with hyphens as the link and then echo the skill without the hyphens to appear on the screen.


    Code:
    <a href="/siteinfo/eventskillsquery.php?skill=<?php echo $row['skill1link'] ; ?>"  class='dealpagelink' >
    <?php echo $row['skill1'] ; ?>
    Code:
    	
    <div class="content">
    <div class="eventskillsbox">
                    <?php
    $query = mysql_query("SELECT skill1, skill2, skill3, skill1link, skill2link, skill3link 
    FROM users ");    
    while($row = mysql_fetch_array($query)) {
    ?>
    <?php if (!empty($row['skill1'])) : ?>
    <div class="eventskillscell">
    <a href="/siteinfo/eventskillsquery.php?skill=<?php echo $row['skill1link'] ; ?>"  class='dealpagelink' >
    <?php echo $row['skill1'] ; ?>
    </a>
    </div>
    <?php endif; ?>
    <?php if (!empty($row['skill2'])) : ?>
    <div class="eventskillscell">
    <a href="/siteinfo/eventskillsquery.php?skill=<?php echo $row['skill2link'] ; ?>"  class='dealpagelink' >
    <?php echo $row['skill2'] ; ?>
    </a>
    </div>
    <?php endif; ?>
    <?php if (!empty($row['skill3'])) : ?>
    <div class="eventskillscell">
    <a href="/siteinfo/eventskillsquery.php?skill=<?php echo $row['skill3link'] ; ?>"  class='dealpagelink' >
    <?php echo $row['skill3'] ; ?>
    </a>
    </div>
    <?php endif; ?>
    
    <?php
    }
    ?>


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
  •