SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast tipiyanos's Avatar
    Join Date
    Jun 2001
    Location
    NY, New York
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    concat query string??

    I had originally posted this query in another thread. But didnt get any reply hence I am posting it as a new thread. Hope to get some response this time.

    I want a search page with next/prev.

    For the next/prev link I am using

    PHP Code:
    <a href='<? $php_self?>?start=<?=$next?>'>Next</a>
    where $next is the counter. but the problem is that the link loads the page productlist.php?start=25 (productlist.php is the page where the link resides) instead of productlist.php?product=blah&size=blah&start=25. The page doesnt pass the original query strings. Is there any way I can concat start=$next to the current url or extract the current url and then concat the start value.

    Also is there any function to find the no. of records in the result set. I need to check the value before increasing the counter so that it doesnt go over the no. of records.

    Any help would be appreciated.

    Thanks

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In short no. In order to make your next/prev links work right you need to pass all variables needed for the query in each link so you will need to just put them in to the link.

    PHP Code:

    <a href="<?=$PHP_SELF?>?product=<?=$product?>&size=<?=$size?>&start=<?=$next?>">Next</a>
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Enthusiast tipiyanos's Avatar
    Join Date
    Jun 2001
    Location
    NY, New York
    Posts
    77
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm... Thanks.

    One more thing. Is there any function to find the total no. of records in a result set of a query so that I can check that my counter doesnt go over that?

    Thanks for the help

  4. #4
    SitePoint Addict manipura's Avatar
    Join Date
    Apr 2001
    Location
    Calgary,AB
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $query = mysql_query('$Query_string");
    $count = $mysql_num_rows($query);

    $count will be the number of rows selected from the query

  5. #5
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by manipura
    $query = mysql_query('$Query_string");
    $count = $mysql_num_rows($query);

    $count will be the number of rows selected from the query
    Not quite. You'll want to take the "$" off the beginning of the mysql_num_rows() function...and I think using a single quote before $query_string, and a double quote afterwards, will probably cause an error.


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
  •