WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : get de errror message to access the database
Categories : PHP, OCI8, Databases Click here to Update Your Picture
Jose Santos
Date : Jul 31st 2003
Grade : 3 of 5 (graded 1 times)
Viewed : 4520
File : 3706.php
Images : No Images for this code example.
Search : More code by Jose Santos
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 



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