SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    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
    17,232
    Mentioned
    194 Post(s)
    Tagged
    2 Thread(s)

    query

    Does $searchtype have the format table.field ??

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    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 gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,336
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    if it works fine outside of php then it's not a database problem, is it

    moving to php forum
    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
  •