By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

Add two functions after OR statement

hsriat
Expert 100+
P: 1,654
[php]$sql = mysql_query($query) or die('Error retrieving data.');[/php]

I want to run a function before die('Error retrieving data.'). Can anyone tell me the syntax how to do that?
Feb 18 '08 #1
Share this Question
Share on Google+
4 Replies


ronverdonk
Expert 2.5K+
P: 4,258
[php]$sql = mysql_query($query) or die('Error retrieving data.');[/php]I want to run a function before die('Error retrieving data.'). Can anyone tell me the syntax how to do that?
You can do it within the IF block, i.e.
[php]
if (!$sql = mysql_query($query)) {
// do what ever you want
die('Error retrieving data.');
}
[/php]
Ronald
Feb 18 '08 #2

hsriat
Expert 100+
P: 1,654
[php]$sql = mysql_query($query) or die('Error retrieving data.');[/php]

I want to run a function before die('Error retrieving data.'). Can anyone tell me the syntax how to do that?
I got the solution,

'and'

[php]$sql = mysql_query($query) or error_given(45) and die('Error retrieving data.');[/php]
Feb 18 '08 #3

ronverdonk
Expert 2.5K+
P: 4,258
That was a close finish. See you next time.

Ronald
Feb 18 '08 #4

hsriat
Expert 100+
P: 1,654
That was a close finish. See you next time.

Ronald

Yeah :)
Thanks for trying. :)
Feb 18 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.