Link to home
Start Free TrialLog in
Avatar of andieje
andieje

asked on

multiple statements one connection pdo

Hi

How do you send multiple statements on one command in pdo

Ihave seent this

http://stackoverflow.com/questions/6346674/pdo-support-for-multiple-queries-pdo-mysql-pdo-mysqlnd

But the tone suggets you shouldnt do it

I have seen mysqli_multiquery

Is there any reason why you shouldnt send mltiple statements in one command in pdp to mysql? Just trying to exany my knowledge
ASKER CERTIFIED SOLUTION
Avatar of Haris Dulic
Haris Dulic
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andieje
andieje

ASKER

ok

1)scenario 1
Make connection
Make repeaed statements on on go
close connection

2)secenrio 2
make db connection
make multiple statements
disconnect

In my case the statements are just imple retrieval,

I dont understand your last sentence. My apologies. Please could you explain. Are you saying more issues sending multiple statements in one go than the benefits?

I can follow that advice.

But you only need to open the database connection once dont you for all your statements? Or do you have to open/close each time to free it up for other users as that seems to be taking time
Basically,

you open connection for sql and close it but here the difference is that in that sql you have multiple SQL statements instead of just one in the first case...

What i meant is that there can be some possible issues in using it than benefits and that you should test it regarding the performances of the database if there is any change and you are ok with it you use if not try not to use it...

Anyway, the best way is that you try and review performance of both approach and then decide...

And no need to apology for not understanding, just ask;)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andieje

ASKER

I've requested that this question be closed as follows:

Accepted answer: 0 points for andieje's comment #a40370276
Assisted answer: 250 points for samo4fun's comment #a40370213
Assisted answer: 250 points for samo4fun's comment #a40370290

for the following reason:

brilliant
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial