PHP provides two extension modules with which we can connect to Oracle:

  • The normal Oracle functions (ORA); and
  • the Oracle Call-Interface functions (OCI).

OCI is frequently used. ORA doesn’t include support for CLOBs, BLOBs, BFILEs, ROWIDs, etc.

Here is a sample PHP script that uses OCI Extension module to connect Oracle.

<?php

$dbuser = “username”;
$dbpass = “password”;
$dbserver = “server”;
$c=OCILogon($dbuser, $dbpass, $dbserver);
if (!$c) {
$err = OCIError();
echo “Oracle Connect Error ” . $err[text];
}

OCILogoff($c);

?>

The following program fetches data from Oracle database using OCI :

<?php

$dbuser = “username”;

$dbpass = “password”;

$dbserver = “server”;

$c=OCILogon($dbuser, $dbpass, $dbserver);

if (!$c) {

$err = OCIError();

echo “Oracle Connect Error ” . $err[text];

}

$query =”SELECT * from student_details”;

$res= OCIParse($c,$query);

OCI_Execute($res, OCI_DEFAULT);

while(OCIFetch($res)){

$student_id = OCIResult($res, “STUDENT_ID”);

echo “Student Id” . $student_id;

}

OCILogoff($c);

?>

For more information , visit the following url:

http://www.orafaq.com/faqphp.htm#WHAT

She is my first and the only love till this point. Her name is Nivedita, a software engineer by profession. She is turning twenty-four shortly and she is undoubtedly the most beautiful girl on earth. I made it a point to share my feelings today with her, hoping this letter would do it all. I have not written any letters in my life till now, and this is perhaps the first time I pen down my thoughts and expectations for the person I love the most on earth.

It’s been four years since we met each other and a strong bond has grown between us through these years. I was unaware of her love for a long time. In fact, I hadn’t spoken a word with her till about a year I had seen her for the first time. It was in one long journey in train, I understood her love for me. It happened a year ago.

It was a trip from Kanyakumari to Chennai in Kanyakumari Express. We had passed Vizhupuram and it was 3 am in the morning. I thought I was the only one who was awake in the whole compartment in that early hour. But to my surprise, she was also awake.

I didn’t know then that it was for me she had got up that early. Hardly had she seemed to move her sight away from me. She smiled at me very often and every time I encountered that cute smile, I started eagerly awaiting the next battle with her smile and shining eyes. Her smile had everything in it, the story of unbelievable affection, care and what not.

From that moment, till now, I too have loved her to a great extent. We have never exchanged words about the love we have towards each other, but words are too less to reflect the amount of affection and love we share. I have always thought that the love would remain throughout our life and it happened to be the same till three months back.

Vivek had come into my life three months back. In fact I myself had waited his arrival for quite a long time, but from the moment he arrived, he has been the worst enemy in my life. Nivedita and he had grown close over times, and the fraction of time she spent with me got lowered to a great extent. Even the latest Sensex fall would be less compared to the fall in her affection for me.

I have wondered how it could suddenly happen, after near to four long years of understanding and love amidst us. At times, I have felt like killing that guy Vivek, but I have not had that much strength or braveness to do that. Still, what can he do? He did no mistake to his part, except for being born charming, cute and fair.

Two days before when I saw her, she was feeding food for him and I was hurt to the core on seeing the incident. My anger had boiled down to tears, and I broke. It took almost close to three hours for me stop crying, I felt I had cried more than how much I would have cried when I was born.

I have been trying to understand where it all went wrong, but to my fortune, till now, I haven’t been able spot it out. Once for all, I decided to tell all my feelings to her, no matter how she is going to deal with it. I have heard my dad saying a lot of times ‘Something is better than nothing!’ and I made up my mind to do ’something’.

I fixed today to be the ‘DATE’ for throwing open in front of her the ‘TALE’ of my pure love for her. I don’t know whether I will get a positive response from her, but I pray God that only the best happens.

Trrrrriinnnnnnggggg…

My school bell has rung. The lunch break is over. My ‘UKG’ classmates would be ready to welcome me with the same cute smile as ever.

I hope my ‘MOTHER’ Nivedita will be alright, understands me and shares some time with me also, apart from that she spends with my three months old rascal ‘BROTHER’ Vivek.

See you after a break!!!

It was a busy morning, about 8:30 am, when an elderly gentleman in his 80’s, arrived to have stitches removed from his thumb. He said he was in a hurry as he had an appointment at 9:00 am.

The doctor took his vital signs and had him take a seat, knowing it would be over an hour before someone would to able to see him.
The doctor saw him looking at his watch and decided, since he was not busy with another patient, he would evaluate his wound.

On exam, it was well healed, so the doctor talked to one of the doctors, got the needed supplies to remove his sutures and redress his wound.

While taking care of his wound, doctor asked him if he had another doctor’s appointment this morning, as he was in such a hurry. The gentleman told no, that he needed to go to the nursing home to eat breakfast with his wife.


Doctor inquired as to her health. He told that she had been there for a while and that she was a victim of Alzheimer’s disease. As they talked, doctor asked if she would be upset if he was a bit late.


He replied that she no longer knew who he was, that she had not recognized him in five years now.

Doctor was surprised, and asked him, “And you still go every morning, even though she doesn’t know who you are?”

He smiled as he patted his hand and said,


“She doesn’t know me, but
“I still know who she is.”

The doctor had to hold back tears as he left, he had goose bumps on his arm, and thought,


“That is the kind of love I want in my life.”

True love is neither physical, nor romantic.

True love is an acceptance of all that is, has been, will be, and will not be.

Once there was a little boy who had a bad temper. His father gave him a bag of nails and told him that every time he lost his temper, he must hammer a nail into the back of the fence.

The first day, the boy had driven 37 nails into the fence. Over the next few weeks, as he learned to control his anger, the number of nails hammered daily gradually dwindled down. He discovered it was easier to hold his temper than to drive those nails into the fence.

Finally the day came when the boy didn’t lose his temper at all. He told his father about it and the father suggested that the boy now pull out one nail for each day that he was able to hold his temper. The days passed and the boy was finally able to tell his father that all the nails were gone.

The father took his son by the hand and led him to the fence. He said,


“You have done well, my son, but look at the holes in the fence. The fence will never be the same.When you say things in anger, they leave a scar just like this one. You can put a knife in a man and draw it out. It won’t matter how many times you say I’m sorry the wound is still there. A verbal wound is as bad as a physical one.”

A general manager wanted to test his people, who had come from all over India, about their values of life. He announced that in their seminar folder, there was a PVC pouch and in it a seed.

When they return, they must put the seed in a pot with good soil and look after it very well. He would hold a competition at the next year’s seminar and that the best plants would be awarded suitably.

Everyone did what was told to him. A year passed quickly. And next year in a big hall, a great scene! There were hundreds of pots and a great variety of plants – all except one. In this one pot was soil, but no plant! The owner of the pot was standing quietly and seemingly ashamed of himself.

The general manager called him on the stage. He asked him what happened and he told him the truth. He planted the seed, which he was given, and did what was to be done – but nothing happened.

The general manager declared him the winner!

Everyone was shocked.

He said, “Gentlemen! The seeds I gave you were boiled seeds. You planted them and nothing happened! You acted smartly and used some other seeds. This man was honest to his work and therefore, he did not cheat me or himself!”

PHP provides a very simpler way to fetch the file extension using the function pathinfo() .

The function pathinfo() returns the information about the file path. It takes two arguments .

1. The first argument is the path to be checked.

2. The second argument is optional.It is used to specify which elements are returned.It composes from PATHINFO_DIRNAME, PATHINFO_BASENAME, PATHINFO_EXTENSION and PATHINFO_FILENAME. It default returns all elements.

The following example fetches the file extension using pathinfo() :

<?php

$path_parts = pathinfo(‘index.php’);

echo “File Extension : ” . $path_parts['extension'];

?>

The output of the above code will be

File Extension : php

In PHP, we can create a log file and write to it, whenever needed. The following is the php file ‘logfile.php’.

<?php
class logfile{
function write($the_string )
{
if( $fh = @fopen( “/logfile.txt”, “a+” ) )
{
fputs( $fh, $the_string, strlen($the_string) );
fclose( $fh );
return( true );
}
else
{
return( false );
}
}
}
?>

In the above example, the class ‘logfile’ has a method ‘write’. This method will write the messages to the log file ‘logfile.txt’. Note that this file should exists before writing to it.

The below file uses ‘logfile.php’ to write the messages to the log file.

require ‘logfile.php’;
$lf = new logfile();
$lf->write(“Writing log file”);
echo “Data written to file”;
$lf->write(“Appending to log file”);

A soldier who was finally coming home after having fought in Vietnam. He called his parents from San Francisco.

“Mom and Dad, I’m coming home, but I’ve a favor to ask. I have a friend I’d like to bring home with me.” ..

“Sure,” they replied, “we’d love to meet him.”

“There’s something you should know the son continued, “he was hurt pretty badly in the fighting. He stepped on a land mind and lost an arm and a leg. He has nowhere else to go, and I want him to come live with us.”..

“I’m sorry to hear that, son. Maybe we can help him find somewhere to live.”

“No, Mom and Dad, I want him to live with us.”

“Son,” said the father, “you don’t know what you’re asking. Someone with such a handicap would be a terrible burden on us. We have our own lives to live, and we can’t let something like this interfere with our lives. I think you should just come home and forget about this guy. He’ll find a way to live on his own.”

At that point, the son hung up the phone. The parents heard nothing more from him.

A few days later, however, they received a call from the San Francisco police. Their son had died after falling from a building, they were told. The police believed it was suicide. The grief-stricken parents flew to San Francisco and were taken to the city morgue to identify the body of their son.

They recognized him, but to their horror they also discovered something they didn’t know, their son had only one arm and one leg.

We can perform mathematical calculations in Linux. The below mentioned command is used for calculations.

‘bc’ is a textmode calculator in linux. bc is a language that supports arbitrary precision numbers with interactive execution of statements.

We need to execute this command in the console.

$bc

2*3000 (Press Enter)

6000

Press quit to come out of the mode.

For more information, have a look at this url

http://linux.about.com/od/commands/l/blcmdl1_bc.htm

class room I walked with my best friends across the campus……… towards my class… my final year engineering class. The hour hand at the watch said … it was ten minutes past 5…. and there was not even a single trace of any life in the college…….. except for we three…. me and my best pals ………..

Another ten steps.. and there was our class with the doors shut… !!! we were on the third floor… and the sun setting down in the valley with its orange rays was creating a magical scene. Had a wish that the time stops at that very moment… but it never happens… the seconds hand ticked heavily….. and we opened the doors of the class for one last time……………….

Wished i cud ask my teacher…”may i come in…. ” and wanted to hear her shout…. “You late again… no attendance…”
but there was no one there… just empty desks.. and we three…. looking at the walls…. and the desks.. all empty… with quotes we wrote … and the raised platform .. where the torture classes were held… and the last benches.. where we had fun…. laughed …. kicked out…. hiding from the teachers… pleading for attendence………… million memories rolled like a muvee into our minds… and there was complete silence for a moment.. and we smiled … laughed!!!!!Walked like heros from the medivial times..fought like the enemies over discussions of Arsenal and Manchester United.. jumped over the benches… had a look at the bench .. where the so called babes of our class used to sit…. hehehe… babes in my engineering college…. a dream in itself… (no offenses to any babes)… ..

drifted to our place… … sat there….. side seats…
dint feel like the last day …. dont remember how we met …. how we came to such a stage… feels like i know my friends from ages… feel like as if i was born in this college….. feel like i was always here…

The entire class was still there alive…. the last benchers sleeping………. the gals chatting amongst themselves……….. the teacher in her own world…… Ajay sitting besides me …. cribbing about something …. prasan sitting on first bench taking down notes…. and Vaibhav smiling at the babes…. Tushar … trying talking to the gals… and we laughing about something of the other….. me occasionally scribbling something on my notepad………… making some sketches.. or bullshit poetry …………

Ahh.. Snehal asking me to look outside… for some babes from C.Tech … standing there……. and i without even a word…looked outside.. it was an unsaid communication…. Sameer pinged me… and i, with the same enthu… looked outside… but today there wasnt anybody there……………. just the deserted corridor………. and i cud see the mechanical department at the end… no one there………………

looked back….. but there was Vikram .. in his dream world…. not scribbling anything in his notebook… not laughing this time…. not sayin anything this time……….. just sitting there.. and there was Sunny… and there was me …..

“roll number 25………. “
“roll number 25………… Abhishek…. u sleeping again…….. “
“Ok fine…………. roll number 26″
“………………….. hey .. present ma’m………… “
“you sleep dear…!!! no attendence for you……………..”

No attendence…. the class has ended… and my friends… chatting and laughing …. going for a chai… aur a samossa….. aur a lemon juice…

and we sat there ….. sat there all alone ……… closed our eyes, for the entire world outside the walls of the campus was calling us…………..

Wanted to attend one last lecture…….. but this time there was no one to take that last lecture…………..

and there was that door… open… and we wished all the time .. to run away …. to bunk.. but this time it wasnt….. one last time…. one last time………… attended the class…. with no one.. just we three…

« Previous PageNext Page »