Aviv Ronen Blog

Jul 15 2008

PHP ociparse Error Handling

ociparse

(PHP 4, PHP 5, PECL oci8:1.0-1.2.4)

ociparse — Alias of oci_parse()

Description

This function is an alias of: oci_parse().


 

$stmt = OCIParse($conn, $query);
if (!$stmt) {
   $err = OCIError($conn);
   echo “Error:”.$err[”message”];

}


Jun 30 2008

PHP MySQL Connect

MySQL Connect

<?php
$connection=mysql_connect(”localhost”, “username”, “password”) or die(mysql_error());
echo “Connected to MySQL<br />”;
?>


Jun 23 2008

Simple PHP Exception Handling explanation

What is an Exception

Finaly, with php5 came a new object oriented way for dealing errors,
if a specified error (exceptional) condition occurs exception handling is used to change the
flow of the code execution .

Exceptions are a great tool and should only be used with error conditions,
dont ever use them to jump to another place in the code at a specified
point - you cant know what will happend.

Basic Use of php5 Exceptions

When an exception is thrown, PHP will try to find the matching “catch” block.

The bad way:

<?php
 function checksum($number1=NULL,$number2=NULL)
   {
       if($number1===NULL OR $number2===NULL)
          {
  throw new Exception("Value must not be NULL");
 }
   return true;
  }
 checksum(7,NULL);
 ?>

The good way:

Good Luck! use this php5 tool smartly.


May 19 2008

Web Developer tools from Opera (Alpha 1)

Released on a open source BSD license! * Reach breaking point step by step * Debug the DOM * Spot your errors * Redefine your style * Think open and free * Debug your phone or TV * Always up to date

read more | digg story


May 19 2008

XML in 10 points

If you are new to XML, it may be hard to know where to begin. This summary in 10 points attempts to capture enough of the basic concepts to enable a beginner to see the forest through the trees.

read more | digg story