class Database
{
public $con;
//by default the system will identify them with var keyword.
var $db;
//these variables you can call any number of times with class objects.
var $die;
function set_db()
//the function will be started here.
{
//make connection to be available for script.
$this->con = mysql_connect("localhost","root","");
if (!$this->con)
{
die('Could not connect: ' . mysql_error());
}
//introduce the db to script.
$this->db = mysql_select_db("idm1", $this->con);
}
function get_db()
//start function to pass results to script.
{
return $this->con;
return $this->db;
}
function close_con()
//provide the close feature to be used by script.
{
$this->die = mysql_close($this->con);
return $this->die();
}
//end of class.
}
Without no argument, The database class will be implemented here to provide the infrastructure for any no of php script.
Tuesday, February 7, 2012
Saturday, December 24, 2011
Realistic Water Reflection Effect
effect to create and you can add it to any photo you like, although it has to work best with images that don't already contain water in them. Here is the original image.
After making the filter effects, The below image seems like being closer to water source.
Tuesday, December 13, 2011
Students accounts with thier own folder
I have created this script for creating folder to upload their works during practical time. So when a student logged in to the system via network they have their own location to transfer the work files.
if (!file_exists($_SESSION['Folder']))
{
$thisdir = "E:\Sumith Bandara";
mkdir($thisdir ."/".$_SESSION['Folder'] , 0777);
header("location:control_panel.php");
}//end file exists
For the val;idating the folder and get their names, The session variables are useful top perform the tasks. Here are the sample code for storing the value.
$sql_stu = "Select * from students where ID = '$row[id]'";
$result_stu = mysql_query($sql_stu);
$row_stu = mysql_fetch_array($result_stu);
$folder_name = $row_stu['FirstName']." ".$row_stu['LastName']. " ".$row_stu['RegNo'];
$_SESSION['Folder'] = $folder_name;
According to above code, the folder name will be created with row element which is retrived by the fetch array query.The site appearance will look like below.
if (!file_exists($_SESSION['Folder']))
{
$thisdir = "E:\Sumith Bandara";
mkdir($thisdir ."/".$_SESSION['Folder'] , 0777);
header("location:control_panel.php");
}//end file exists
For the val;idating the folder and get their names, The session variables are useful top perform the tasks. Here are the sample code for storing the value.
$sql_stu = "Select * from students where ID = '$row[id]'";
$result_stu = mysql_query($sql_stu);
$row_stu = mysql_fetch_array($result_stu);
$folder_name = $row_stu['FirstName']." ".$row_stu['LastName']. " ".$row_stu['RegNo'];
$_SESSION['Folder'] = $folder_name;
According to above code, the folder name will be created with row element which is retrived by the fetch array query.The site appearance will look like below.
Wednesday, November 30, 2011
Proposed DBMS diagram for Student Progressive System
Here I have written this php script to update their remote exercise folder with their own assessments. So students can upload them all into one directory with named by students.
The log in section and new user registration section had managed totally by MySQL statements. For the administering section, I have allocated another script class which are related with sessions.
Every coding of the system has used OOP concepts in PHP. So It is more better and reliable than others.
My Pr-designed DBMS structured diagram is as follows.
Friday, November 18, 2011
Students Progressive System.
Here we can analyze the students status with their individual assessments score and how they make the score higher with chart.
Here is the code for uploading assessments to the server.
HTML Script:
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="file" name="fileUpload" />
<input type="submit" value="Upload" />
<input type="file" name="fileUpload" />
<input type="submit" value="Upload" />
</form>
PHP Script "upload.php":
//if you have selected, the shift from temporary memory to the destination folder
//with the integrated PHP function move_uploaded_file()
if (move_uploaded_file(
$_FILES['fileUpload']['tmp_name'],"./Students Files/".$_FILES['fileUpload']['name']))
{
echo '<p>File sent successfully</p>';
}
else{
//if the file is not uploaded, inform it with a message
echo '<p>We could not upload the file</p>';
}
//with the integrated PHP function move_uploaded_file()
if (move_uploaded_file(
$_FILES['fileUpload']['tmp_name'],"./Students Files/".$_FILES['fileUpload']['name']))
{
echo '<p>File sent successfully</p>';
}
else{
//if the file is not uploaded, inform it with a message
echo '<p>We could not upload the file</p>';
}
banner design for the page:
Wednesday, November 2, 2011
Practical view of OOPs Concept in PHP and MySql
For the display of the Menu on each page which has been opened, there is created a class and declare their object on location where you want to display them in your php script.
PHP class script "menu.php":
class Menu{
function set_Menu()
{
echo"<a href='/default.php'>Home</a>";
echo " ";
echo"<a href='/tutorials.php'>Tutorials</a>";
}
}
function set_Menu()
{
echo"<a href='/default.php'>Home</a>";
echo " ";
echo"<a href='/tutorials.php'>Tutorials</a>";
}
}
PHP Script:
<div class="leftmenu">
<?php
include("menu.php");
$objVar = new Menu();
$objVar ->set_Menu();<?php
include("menu.php");
$objVar = new Menu();
?>
</div>
Here I have mentioned the few code blocks for relating to the database and it is reduced the complexity of the codings and software bugs.
//declare the parent class
class database
{
//create variable
var $con;
var $results;
public $msg;
//declare function for connecting database
function set_db()
{
//here is the code for connecting database
$this->con=mysql_connect("localhost","root","");
//end of the function
}
//declare getter function for connection to database
function get_db()
{
return $this->con;
//call another function if the connection was not established
return $this->get_exception();
}
//declare the exception function for the connection
function get_exception()
{
if (!$this->con)
{
return('Could not connect: ' . mysql_error());
}
}
//declare the fucntion for selecting database
function select_db()
{
$this->db = mysql_select_db("lib_db", $this->con);
}
//declare the setter function for executing query
function set_query($query)
{
////sotring values by retriving parameter from the main php file
$this->results = mysql_query($query);
}
//declare the getter function for returning the values
function get_query()
{
return $this->results;
}
//declare the function for closing the mysql connection
function close_db()
{
//code for closing mysql connection
mysql_close($this->con);
}
function execute_query($sql)
{
if (!mysql_query($sql,$this->con))
{
return('Error: ' . mysql_error());
}
}
function set_message($message)
{
$this->msg = $message;
}
function get_message()
{
return "<b><font size=5 type=verdana color=blue>".$this->msg."</font></b>";
}
}
Hereafter we call them at any time ,any location with any no of objects. See sample code...
//link class library
include("class_database.php");
//define object for the class
$objDB = new database();
//call their method for calling setter function
$objDB->set_db();
//calling getter function for connection
$objDB->get_db();
//calling the function for selecting database
$objDB->select_db();
//store all information after execute query.
$objDB->execute_query("INSERT INTO Books(TitleID,Notes)VALUES('$_POST[titleids]','$_POST[notes]')");
//calling setter function for message
$objDB->set_message("You have succesfully 1 record added");
Analog Stations- Control PCB Found with Controls
Analog stations offer “simple value” for new applications.
These tough and proven controls will directly replace Strand’s
MicroControl line of analog stations. Available from single to 12
channel with master, preset and take control functions.
But here I have used 7 control analog equalizer for two channel speakers.
These universal stations are commonly supplied for 0-10VDC applications but can be used in applications up to 28VDC making them excellent choices for retrofitted almost any analog station. Specially for the MP3 song playing or dual channel video watching with front speaker of the surround system.
Completed Control PCB has been followed.
But here I have used 7 control analog equalizer for two channel speakers.
These universal stations are commonly supplied for 0-10VDC applications but can be used in applications up to 28VDC making them excellent choices for retrofitted almost any analog station. Specially for the MP3 song playing or dual channel video watching with front speaker of the surround system.
Completed Control PCB has been followed.
Subscribe to:
Posts (Atom)







