SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: Can anyone see a probelm with this query ?

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can anyone see a probelm with this query ?

    I have the below query that will query one table but retirve data from two tables, yet not producing an output.

    PHP Code:

    $tablestatuse 
    ="select ptable.tableid, ptable.statuse, ptable.timestamp1, ptable.memid member2.name, member2.lname, member2.memid from ptable, member2 where ".$searchtype." like '%".$searchterm."%' and member2.memid=ptable.memid"
    it works fine when i take the ".$searchtype." like '%".$searchterm."%' out.

    Any ideas

    Cheers

    Dug

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    14,427
    Mentioned
    72 Post(s)
    Tagged
    1 Thread(s)

    query

    Does $searchtype have the format table.field ??

  3. #3
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,513
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    take your query, substitute the variable value, and run it outside of php

    then report if it works or what the error message was
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    505
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    QUOTE:

    Does $searchtype have the format table.field ??

    No perhaps thats whats causing it not to work.


    QUOTE:

    take your query, substitute the variable value, and run it outside of php

    then report if it works or what the error message was


    It works fine outside php.


    Thanks


    Dug

  5. #5
    SQL Consultant silver trophybronze trophy
    SitePoint Award Recipient r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    38,513
    Mentioned
    35 Post(s)
    Tagged
    1 Thread(s)
    if it works fine outside of php then it's not a database problem, is it

    moving to php forum
    r937.com | rudy.ca | 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
  •