Hi All,
I am working on a project for a university, i am doing it in PHP4 & MYSQL.
And i am cosely to finish the project. Now the client is telling that they
want the database as ORACLE (NOT MYSQL). I had wrote a class file for
interacting with the database and i am using that class file for database
activities.
How can i change the whole project to PHP4 & ORACLE. Is it a big issue? Or i
just need to change the database class file. Is any chance of serious issues.
I am using FCK Editor too for the project. Is there may be any problems with
the table types and filed types.
Please help me with your suggestions.
Thanks in advance.
Here is my class file
=================================
<?php
require_once "configuration_settings.php";
class database
{
var $mysqli;
var $HostName;
var $UserName;
var $Password;
var $DatabaseName;
var $ErrorInfo;
function database()
{
$this->HostName = DB_HOST;
$this->UserName = DB_USER;
$this->Password = DB_PASSWORD;
$this->DatabaseName = DB_NAME;
}
# The following method establish a connection with the database
server and on success return TRUE, on failure return FALSE
# On failure ErrorInfo property contains the error information.
function dbConnect()
{
$this->mysqli = mysql_connect($this->HostName,
$this->UserName, $this->Password);
if(!$this->mysqli) {
$this->ErrorInfo = mysql_error();
return FALSE;
} else {
if(!mysql_select_db($this->DatabaseName))
{
$this->ErrorInfo = mysql_error();
return FALSE;
} else {
return TRUE;
}
}
} # Close method dbConnect
function dbClose()
{
mysql_close($this->mysqli);
} # Close method dbClose
# On insert, update it returns TRUE, and on select it returns result set
object
function setQuery($Query)
{
$ExecStatus = mysql_query($Query, $this->mysqli);
if($ExecStatus === FALSE) {
$this->ErrorInfo = mysql_error();
return FALSE;
} else {
return $ExecStatus;
}
} # Close method setQuery
# On Success returns number of records corresponding to the query, else
return 0
function numberOfRecords($Query)
{
$RowCount = 0;
$ResultSet = mysql_query($Query, $this->mysqli);
if($ResultSet) {
$RowCount = mysql_num_rows($ResultSet);
mysql_free_result($ResultSet);
return $RowCount;
} else {
$this->ErrorInfo = mysql_error();
return $RowCount;
}
} # Close numberOfRecords method
# Returns an array of rows in the result set
function readValues($Query)
{
$ResultData = array();
$ResultSet = mysql_query($Query, $this->mysqli);
if($ResultSet) {
$RowCount = mysql_num_rows($ResultSet);
for($i=0; $i<$RowCount; $i++)
$ResultData[$i] = mysql_fetch_array($ResultSet);
mysql_free_result($ResultSet);
return $ResultData;
} else {
$this->ErrorInfo = mysql_error();
return $ResultData;
}
} # Close method readValues
# Return a single row
function readValue($Query)
{
$ResultData = array();
$ResultSet = mysql_query($Query, $this->mysqli);
if($ResultSet) {
$ResultData[0] = mysql_fetch_array($ResultSet);
mysql_free_result($ResultSet);
return $ResultData[0];
} else {
$this->ErrorInfo = mysql_error();
return $ResultData;
}
} # Close method readValue
# Method returns the last insert Id of this connection
function getInsertId()
{
return mysql_insert_id();
}
function readField($Query)
{
$ResultData = array();
$ResultSet = mysql_query($Query, $this->mysqli);
if($ResultSet) {
$ResultData[0] = mysql_fetch_array($ResultSet);
mysql_free_result($ResultSet);
return $ResultData[0];
} else {
$this->ErrorInfo = mysql_error();
return $ResultData;
}
} # Close method readValue
} # Close class definition
?>
=================================
By
Girish.
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small
Business.
[Non-text portions of this message have been removed]
Community email addresses:
Post message: [email protected]
Subscribe: [EMAIL PROTECTED]
Unsubscribe: [EMAIL PROTECTED]
List owner: [EMAIL PROTECTED]
Shortcut URL to this page:
http://groups.yahoo.com/group/php-list
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/php-list/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/php-list/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/