How to join two queries?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
adilmarwat2004
Forum Commoner
Posts: 44
Joined: Fri Sep 04, 2009 11:28 pm

How to join two queries?

Post by adilmarwat2004 »

$query = "SELECT * FROM info";

$query2 = "UPDATE info SET qty = round(`marks`/550*100, 2)";

How i join these two queries within one query in php page.

please help.

Adil
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: How to join two queries?

Post by social_experiment »

I dont think you can combine 2 different actions (SELECT and UPDATE) into one query.

Why would you want to join the queries?
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
ell0bo
Forum Commoner
Posts: 79
Joined: Wed Aug 13, 2008 4:15 pm

Re: How to join two queries?

Post by ell0bo »

You won't want to do that. Just leave them as two separate queries.

However, is there as particular reason you want to have them become one?
Post Reply