Jump to content

Filtering MySQL entries by two variables


SephirGaine

Recommended Posts

Hola. Just a quick question, should be easy to answer, and needless to say I feel real amateur not knowing the answer. However, I want to echo all data entries from a DB table, however I want to be able to filter through using two variables. One is easy enough, simply use SELECT X from Table WHERE Y=Z. But, I want to use two WHERE variables in the same string. What's the proper way to do so?

And if it's actually needed, I need to select these from a certain year, and whether or not they're open tickets at the time. So, for this mini-project, "Date" and "Dead" are going to be my two variables I want to filter through.
Link to comment
Share on other sites

One more quick question. Having trouble displaying the entries now, narrowed it down to something in my mysql query. I've looked over it too many times to count and I'm not too sure what's wrong, however.

[code]"SELECT * FROM Leads where Date='$LeadYear2' AND Dead=0 ORDER BY '$LeadSort' ASC"[/code]
Link to comment
Share on other sites

Ah, disregard that, sorry. Got it figured out. What was happening, however, was that when I took out "where Date='$LeadYear2' AND Dead=0 ORDER BY '$LeadSort' ASC"" it would display all the results within that table like it should, and as soon as I placed the rest of the query back in and tried, nothing would show. It was basically just a stupid mistake on my own part, however. Thanks.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.