|
|
|
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]
|
|
| Logs hits to any page which includes it. Automatically utilises page access information left behind by PHP/FI2.0. Categories : Databases, PHP, mSQL, Databases | | | StoredProcedure, Stored Procedure, Oracle, OCI8, OCI8i Categories : OCI8, Oracle, Databases, PHP | | | 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 | | | Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases, PHP, MySQL, Complete Programs | | | Cut your MySQL Connections to 1 line of code Categories : PHP, Beginner Guides, Databases, MySQL | | | phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL, Complete Programs, Ecommerce, PHP, Databases | | | Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL, Complete Programs, General SQL, PHP, Databases | | | Message of the Day - Random Message (Needs MySQL!) Categories : Databases, HTML and PHP, PHP, MySQL | | | Alternating background color for HTML table rows Categories : PHP, Databases, MySQL, HTML and PHP | | | A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL | | | Tropicalm Genetree Family (MySQL based family tree) Categories : PHP, Interfaces, Databases, MySQL, Complete Programs | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | Automatically printing the contents of an sql table in MySQL. Categories : MySQL, PHP, HTML and PHP, Databases | | | Email a user with out exposing email address Categories : PHP, Databases, MySQL, Email | | | Authorize Me! An authentication script. Categories : MySQL, Databases, Authentication, PHP | |
|
|
|