SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot TheMonk's Avatar
    Join Date
    Oct 2005
    Location
    Canada
    Posts
    143
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Limits in comples query

    Hello,

    I'm currently working on a pagination system and have run into some problems. I'm using "LIMIT" to determine which results should be displayed. It's working fine on one query but not another.

    Firs here is the code I'm using to create the limit portion of the string:
    PHP Code:
    $max 'limit ' .($pagenum 1) * $page_rows .',' .$page_rows
    Next I apply it like so to the first query (which works great):
    PHP Code:
    $sql "SELECT id, first_name, last_name, department, phone FROM staff_dir $max"
    Then I try to apply that same logic to a similar query in another piece of code and I keep getting an error. Here's the query statement:
    PHP Code:
    $sql 'SELECT id, first_name, last_name, department, phone FROM staff_dir WHERE department LIKE "'.$_SESSION['submittedDepartment'].'%" $max'
    Am I just not constructing this properly?

    Thanks

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,341
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    thread moved to php forum

    you might want to mention what the error message said
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •