Results 1 to 5 of 5

Thread: MySQL query [Resolved]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    MySQL query [Resolved]

    I am having problems with a query. It looked like this (here it works):

    Code:
    $resultat = mysql_query("select fArrID, fBy, fDato, fSted, fNavn, fText, fBildebox from fremover where fBy like 'B' and fDato >= ".$StartDato." ORDER BY fDato",$db);
    But I also want it to catch those where "fBy like 'A'

    I tried this:

    Code:
    $resultat = mysql_query("select fArrID, fBy, fDato, fSted, fNavn, fText, fBildebox from fremover where fBy like 'A' or where fBy like 'B' and fDato >= ".$StartDato." ORDER BY fDato",$db);
    and this

    Code:
    $resultat = mysql_query("select fArrID, fBy, fDato, fSted, fNavn, fText, fBildebox from fremover where fBy like 'A' or fBy like 'B' and fDato >= ".$StartDato." ORDER BY fDato",$db);
    But no luck...any idea?
    Last edited by NoteMe; Jul 24th, 2004 at 12:10 PM.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Not sure about mySQL, but in MSSQL or evben Access, when you use the LIKE clause, don't you need to include some kind of wildcard character??

    LIKE '*A*' or LIKE 'B*'

    ???

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I just tested without WHERE once more, and then suddenly the warning dissapeared...but it is still just picking the once with B and not the once with A..


    Tried your solution, but it didn't help techgnome. It worked with just 'B' in it, but I still can't get the 'A's to work with it..

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    hhm.. I know this is a terrible work around, but you could do two queries, then combine the arrays.
    Have I helped you? Please Rate my posts.

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Yeah I could...but the ultimate solution in the end was trying one thing then go back...and suddenly it worked with the last solution I posted in my first post...I have NOOO idea why...maybe it did flush the cache corectly or something....bad bad bad...at least now it works...so I am not touching it again....thanks to all of you..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width