#37925 [Bgs]: After a try catch block, the echo doens't work with an exit

From: Date: Fri, 30 Jun 2006 11:06:55 +0000
Subject: #37925 [Bgs]: After a try catch block, the echo doens't work with an exit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98989@lists.php.net to get a copy of this message
 ID:               37925
 Updated by:       tony2001@php.net
 Reported By:      batataw at gmail dot com
 Status:           Bogus
 Bug Type:         Output Control
 Operating System: Linux Fedora
 PHP Version:      5.1.4
 New Comment:

42000:1305:PROCEDURE test.user_insert does not exist


Previous Comments:
------------------------------------------------------------------------

[2006-06-30 10:56:55] batataw at gmail dot com

<?php

		define ('DRM_DMDB_DEV',  'dev');

		$GLOBALS[DRM_DMDB_DEV]['db_dsn'] 		=
"mysql:dbname=mydatabase;host=localhost";
		$GLOBALS[DRM_DMDB_DEV]['db_user']		= "root";
		$GLOBALS[DRM_DMDB_DEV]['db_passwd']		= "";
		
		$conf = DRM_DMDB_DEV;


	   	try{
			$db = new PDO($GLOBALS[$conf]['db_dsn'], $GLOBALS[$conf]['db_user'],
$GLOBALS[$conf]['db_passwd']);
			$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
			$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);			
		}
		catch(PDOException $e){			
			$errmsg = "connection failed: ".$e->getMessage();
			echo $errmsg;
			exit;
		}	

    	    	
    	    	
		//call the stored procedure
		$sql = "CALL user_insert(@userId,:username,:passwd);";
				
		//Prepare request
		try{
			$sth = $db->prepare($sql);
		}
		catch(PDOException $e){				
			$errmsg = implode(":",$sth->errorInfo());
			Error::userErrorHandler(E_USER_WARNING, $errmsg, __FILE__, __LINE__,
DRM_ERROR_DB_CALL);						
		}
		
		
		$sth->bindParam(":username",	$user["username"],PDO::PARAM_STR);
		$sth->bindParam(":passwd",		$user["passwd"],PDO::PARAM_STR);
																							
		//Execute Request
		try{
			$sth->execute();
		}
		catch(PDOException $e){
					
			$errmsg = implode(":",$sth->errorInfo());
			echo $errmsg;
			exit; 						
		}		
		
		
		echo "OK !";
		

?>

------------------------------------------------------------------------

[2006-06-27 11:53:50] tony2001@php.net

Please provide SHORT AND COMPLETE reproduce script, which I can
copy/paste and run to reproduce your problem.
Until then -> bogus.

------------------------------------------------------------------------

[2006-06-27 11:52:05] bjori@php.net

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.




------------------------------------------------------------------------

[2006-06-27 11:30:52] batataw at gmail dot com

<?
public function insertUser($user){		    	    		
		
	//call the stored procedure
		$sql = "CALL
user_insert(@userId,:username,:passwd,:firstname,:lastname,:email,:web,:country,:language,:gender,:city,:dob,:initial,:avatar,:servicelevelId);";
				
		//Prepare request
		try{
			$sth = $this->db->prepare($sql);
		}
		catch(PDOException $e){				
			$errmsg = implode(":",$sth->errorInfo());
			Error::userErrorHandler(E_USER_WARNING, $errmsg, __FILE__, __LINE__,
DRM_ERROR_DB_CALL);						
		}
		$sth->bindParam(":username",	$user["username"],PDO::PARAM_STR);
		$sth->bindParam(":passwd",		$user["passwd"],PDO::PARAM_STR);
		$sth->bindParam(":firstname",	$user["firstname"],PDO::PARAM_STR);
		$sth->bindParam(":lastname",	$user["lastname"],PDO::PARAM_STR);

//Execute Request
		try{
			$sth->execute();
		}
		catch(PDOException $e){
					
			$errmsg = implode(":",$sth->errorInfo());
			Error::userErrorHandler(E_USER_WARNING, 'DB Error : '. $errmsg,
__FILE__, __LINE__, $errmsg);				echo "Error Message";
exit;		
		}		

}
?>

------------------------------------------------------------------------

[2006-06-27 11:25:37] tony2001@php.net

I don't think I have $sth and Error::userErrorHandler() method. That's
why I asked for short but COMPLETE reproduce script.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/37925

-- 
Edit this bug report at http://bugs.php.net/?id=37925&edit=1


Thread (11 messages)

« previous php.bugs (#98989) next »