|
|
|
|
|
get de errror message to access the database.
This function get one error message, through ocierror(),
with the essencial information to describe the error origin.
parameters:
$connection - connection to database
$condition - condition to test
$statement - statement executed
$querysql - query sql executed
return:
$error_msg - error message
| <?php
function getDatabaseError($connection,$condition,$statement,$querysql){
$error_msg = "";
if (!$condition){
ocilogoff($connection);
// verify if is connection or statement error
if ($statement == "") $error = ocierror();
else $error = ocierror($statement);
$error_msg = $error["message"];
// append, if exist, the query sql
if ($querysql != "") $error_msg .= " [".$querysql."]";
}
return $error_msg;
}
?> | |
Usage Example
| <?
$conn = ociloggon();
$error_msg = getDatabaseError($conn,$conn,"","");
$sql = "select * from people where name=".$name;
$stm = ociparse($conn,$sql);
$exec = ociexecute($stm);
$error_msg = getDatabaseError($conn,$exec,$stm,$sql);
?> | |
this obtain:
ORA-01017: name of user/invalid password; entry of session refused
ORA-00904: name of column invalid [select * from people where name=".$name]
|
|
| This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server. Categories : Databases, MySQL, Complete Programs, PHP, Databases | | | StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i Categories : OCI8, Oracle, Databases, PHP | | | Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0. Categories : Databases, PHP, mSQL, Databases | | | Mimic ASP's GetString function with PHP Categories : PHP, Databases, MySQL, Strings | | | XDT Topsite (Gold v1.0) Categories : Databases, CSS, PHP, HTML and PHP, Sessions | | | Add, Edit /Update & Delete all in one Contact Management Form Categories : PHP, MySQL, Databases, Beginner Guides | | | Implementing a Members ONLY area Categories : PHP, MySQL, Databases, Authentication | | | EasySQL - connect to MySQL with just 1 php file Categories : PHP, To MySQL, Databases | | | This functions makes it easy to use session-variables known from ASP. With one Cookie the array "session" will save and restore from a db-record. In this version MySQL is used but it's should very easy to change Categories : PHP, Arrays, Cookies, MySQL, Databases | | | AITSH Statistics Categories : Complete Programs, Databases, HTML and PHP, Sessions, PHP | | | Making a simple Hit-Log using PHP and MySql Categories : PHP, Log Files, Beginner Guides, Databases, MySQL | | | Newbie Notes #10 - Generating drop downs Categories : PHP, MySQL, HTML, Beginner Guides, Databases | | | complete, simple, working example of a login screen/system using php functions, cookies, and a mysql database for begginers. Categories : Authentication, Complete Programs, PHP, MySQL, Databases | | | A couple of functions that convert an IP address into its color code and not-color-code. Useful when viewing an apache log with a mysql result grouped by IP Categories : PHP, Graphics, Databases | | | A Simple Script to randomly select a CSS from MySQL Categories : PHP, Databases, MySQL, CSS | |
| |
| |
|