SephirGaine Posted September 21, 2006 Share Posted September 21, 2006 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. Quote Link to comment Share on other sites More sharing options...
Barand Posted September 21, 2006 Share Posted September 21, 2006 SELECT ..... WHERE YEAR(date) = '$theYear' AND Dead = '$deadValue' Quote Link to comment Share on other sites More sharing options...
SephirGaine Posted September 21, 2006 Author Share Posted September 21, 2006 Coo'. Easy enough, thanks. Quote Link to comment Share on other sites More sharing options...
SephirGaine Posted September 21, 2006 Author Share Posted September 21, 2006 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] Quote Link to comment Share on other sites More sharing options...
Barand Posted September 21, 2006 Share Posted September 21, 2006 Define "having trouble".We have no idea what is in your table or what is in your variables or what it is doing that shouldn't be doing or what it's not doing that it should. Quote Link to comment Share on other sites More sharing options...
SephirGaine Posted September 21, 2006 Author Share Posted September 21, 2006 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.