Is there anyway to have (in one query) two separate queries? For example if query one fails then it will not affect the rest of it. Example code:

Say that the lastLogin table does not exist:
UPDATE userInfo SET lastLogin=3 WHERE id=5
UPDATE userInfo SET LastLogin=3 WHERE id=5

Is there anyway to get the second line to execute (in a single query) even though the first line would cause an error?

Recommended Answers

All 2 Replies

How will you run 2 separate queries in a single query

UPDATE userInfo SET lastLogin=3 WHERE id=5
UPDATE userInfo SET LastLogin=3 WHERE id=5

These are 2 update statements.if you want to run them in a sequence put SEMI COLAN at the end(;) that way even the first fails the rest will execute

if you wrote two seperate update queries..
obviously, if the first one fails,the second one will execute..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.