zgkhoo Posted October 29, 2007 Share Posted October 29, 2007 $con = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql'); y need die('Error connecting to mysql');?? wat will happen if without this or die();? Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/ Share on other sites More sharing options...
fenway Posted October 29, 2007 Share Posted October 29, 2007 This is really a PHP question; in the production environment, no script should ever die(). This part of the statement will run if mysql_connect() returns a value that evalutates to false. Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/#findComment-380562 Share on other sites More sharing options...
zgkhoo Posted October 29, 2007 Author Share Posted October 29, 2007 it is mandatory to have this behind? if i dun add this line? wat bad thing might be happen? thanks.. Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/#findComment-380606 Share on other sites More sharing options...
roopurt18 Posted October 29, 2007 Share Posted October 29, 2007 wat bad thing might be happen? Your script will continue to run even though it hasn't connected to the database. This isn't necessarily bad, but it certainly could be. Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/#findComment-380619 Share on other sites More sharing options...
zgkhoo Posted October 30, 2007 Author Share Posted October 30, 2007 if occur this error msg die() then my program stop immediately ? thanks Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/#findComment-380823 Share on other sites More sharing options...
teng84 Posted October 30, 2007 Share Posted October 30, 2007 yes ! take it from the word die if you know the meaning of die then thats it Quote Link to comment https://forums.phpfreaks.com/topic/75243-why-need-or-die/#findComment-380851 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.