Eggzorcist Posted June 27, 2012 Share Posted June 27, 2012 Hi everybody. I was just wondering whether there is a value in PHP we can plugin to the PDO which makes it so it suits all values? In practice I want to use a PDO statement for two functions. Here is my PDO->prepare statement.. "SELECT users.firstname, users.lastname, users.id, owing.type, owing.forWhat, owing.amount FROM users, owing WHERE (owing.ownee = ? && owing.ower = ?) && owing.status = ?" The thing is I use this data in two different ways. One dataset needs owing.ownee to me userID and the other can be whatever. While the second dataset needs the ower to be UserID while it doens't matter who the ownee is. I was wondering if this were possible or did I need another query entirely? Quote Link to comment Share on other sites More sharing options...
scootstah Posted June 27, 2012 Share Posted June 27, 2012 You don't need another query, you just need to use different data when you bind it. Quote Link to comment Share on other sites More sharing options...
Eggzorcist Posted June 28, 2012 Author Share Posted June 28, 2012 Yes I'm aware of that. But in one I try to bind the first query with the owing.ownee = USERID and owing.ower = "every value found". while the second query is the opposite. How would I do that? So technically I don't need one of the parameters in each query but to save on a query I put in both. My question was how can I bind a value that makes it so that logic or value doesn't matter whatever it is. so I can catch owing.ower = every value. 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.