SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Match name for name to obtain the specific number from db

    <center>Page:
    <?php
    $query = "SELECT Pages FROM Boxes"; $result = mysql_query($query);
    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    for ($count == 1; $count <= $row['Pages']; ++$count) {
    echo "<a href='$count.php' rel='$name' title='$name'>$count</a> ";
    }
    ?>
    </center>

    the table in the database is layed out this way e.g:

    Letter Name Pages
    A Apple 1
    A Aeon 1
    D Dave 4
    S Same 2

    Using this script I am able to fetch the number of pages from the database and render them as links but one thing I am still unable to do with it is match the name with the name from the page to obtain the specific number from that row of the table for that product.

    How would I obtain such results?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,508
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Code:
    SELECT Pages 
    FROM Boxes
    WHERE Name = 'REDmarkX'
    Of course you'll have to get the name you want to extract from somewhere ($_POST, $_GET or $_SESSION for example).

  3. #3
    SitePoint Member
    Join Date
    Dec 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking

    Thank you... it is functional.


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
  •