summaryrefslogtreecommitdiff
path: root/doc/nils-diplom/Dateistruktur/lessons/errror_tests.php
blob: cb59e58fd42a11f0c877c43cf37dec4cff8b524f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?


$sql = "test";

fehler($sql);

// Display OCI error
function PrintOCIError($err)
{
  echo "<pre>".$err['message']."</pre>\n";
  die();
}


function fehler($stmt)
{

	$username  = "nils";
	$password  = "nils";
	$database =  "ora9";

	$con = @OCILogon($username, $password, $database);
	if (!$con) {
				$e = OCIError();  // For OCILogon errors pass no parameter
				PrintOCIError($e);
				}

	echo "Connected OK\n";

	$stid = @OCIParse($con, $stmt);
	if (!$stid) 
		{
		$e = OCIError($con);  // For OCIParse errors pass the connection
		PrintOCIError($e);
		}

	echo "Parsed OK\n";

	$r = @OCIExecute($stid);
	if (!$r) 
		{
		$e = OCIError($stid); // For OCIExecute errors pass the statement
		PrintOCIError($e);
		}

		echo "Executed OK\n";
}



?>