Jump to content

PHP5 and reusing PDO prepare statements.


Eggzorcist

Recommended Posts

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?

Link to comment
Share on other sites

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

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.