var $Server = "";
var $Database ="";
var $User = "";
var $Conn = "";
var $Query_ID = "";
var $Record = array();
var $Row;
var $Password="";
/**********************************************************
This function gives the error msg
***********************************************************/
function raju_halt($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
/***********************************************************
Explaination About the Class :
In this Class i am sending the 4 parameters.
1. $TableName is the name the Table in the Database.
2. $TestField is the field on which you would like to
where condition.
3. $Field1 is the name of the field which you would like to
get from the database.
4. $Fieldn is the the value of the field.
example:
select ename($Field1 u can have as many values as u wish like $Field2...... form emp
($TableName) where empno($TestField) = &1($Fieldn);
*/
/***********************************************************
You can use this class for any database. here i am showing
you using MS-SqlServer.
*/
function raju_selectwhere($TableName,$TestField,$Field1,$Fieldn) {
//$TableName is the Name of the Table from which u would like to query.
//$TestField is the Name of the Column on which u would like to perform where condition.
//establish connection with database
$this->connect();
//Here the query is executed.
$this->Query_ID = mssql_query($Query_String,$this->Conn);
//if the query contains no records it will give error.
if (!$this->Query_ID) {
$this->raju_halt("Invalid SQL: ".$Query_String);
}
//the function returns the no of records.
return $this->Query_ID;
}
}
/* cut here
/* cut here
/* raju_local.inc */
<?php
/*
raju_local.inc which is the extended class of raju_mssql.inc
in which u can give ur database name, username,password
of the database.
*/
class DB_Sample extends DB_Sql {
var $Server = "yourservername";
var $User = "yourusername";
var $Database = "yourdatabasename";
var $Password = "yourpassword";