Monday, March 24, 2008

Make a Wish meme

The “Make A Wish” Meme

Here is the rules :

1. Think about what it is that you want more than anything, what your heart’s desire and fondest wish is, and what it is that you would wish for if you were to see the above wishing star flame across the night sky.

I was tagged by Etavasi
2. Right click and SAVE the blank graphic above.

3. Use a graphics program of your choice and place your wish on this picture.

My wish:

Now, I'm Tagging
Is is colorful or not?
JehzLau Concepts

Related Posts:
15 LUFFS meme
My Desktop (Printscreen Meme)
6 Weird Things About Me
What does ISIS means?
Worldwide Link Love!
I hate!
Amazing Blog Award ^_^
Strong Coffee Award
Why 8 Meme?

PayPal Related Posts:
Withdraw PayPal using Philippines Bank Account from PayPal Bank Codes
Paypal Account for Philippines How to verify your PayPal account?


Sunday, March 23, 2008

Hidden Manna: Amicable Competition

Graduation! hmmm Congrats to all the 2008 Graduates.
This may differ from all of my previous post, it is just that I can't get it off my mind so I guess will write it here to remind us what we are IN for this world... the planet called Earth.
The two students were drinking their last beer after the Seniors’ Prom marking their graduation. The following day their class would scatter to the four corners of the country. So this was their last beer until their class’s official homecoming ten years hence. The moment was almost solemn for Jonathan Richmond and Charlie Quarter. And, although they had never been very close during the preceding four years (their values and lifestyle were too contrasted to allow for deep friendship between them), nevertheless they felt the special significance of this time of separation...“All right, Jonathan,” Charlie said, “I’m ready to bet that when we meet in ten years’ time, I’ll be three times riches than you’ll be.”
Such a statement was pure Charlie Quarter. For it expressed perfectly the young man’s extremely competitive nature. Not just because Charlie was ready to bet on anything (he said it make life so much more interesting), but because he loved to humiliate his opponents by delivering them a crushing defeat whenever possible. And unfortunately, he was as unscrupulous as he was ruthless. As long as he won, he didn’t care what means he used to achieve his goal. Jonathan Richmond, on the other hand, always preferred cooperation to competition. Or if one insisted on using the term “competition,” he would always soften it into the expression “friendly competition.” Moreover, Jonathan was about the closest thing you could ever find to a really honest man. To his upright nature, deceit and crooked means were as unthinkable as a flash of lightning in a blue sky. And so, he felt no inclination to take up his classmate on the latter’s cocky bet, in the feat that such a bet would only incite him to be even more unscrupulous in the next ten years. However, since he didn’t want to offend Charlie during their last minutes together, he tactfully rephrased his companion’s proposal.

“Well, Charlie,” he replied with a friendly laugh, “you know I’m not much of a gambler. Never had the nerves for it. But maybe in ten years we can compare notes and see if both of us have made good, each in his line of business. Hopefully, we will have. And I’ll be the first one to drink a toast to your success, my friend.”
This conversation proved to be the two young men’s last contact until the homecoming ten years later. In the mean time each launched on in different directions, directions that differed with regard to their business careers and, even more so, with regard to their spiritual evolution.

Charlie Quarter began his career by opening a modest retail store with a partner. They sold computer equipment both hardware and software. Within a year, though, Charlie had managed to defraud his partner of his share of the business. Then he joined forces with another, bigger retailer, whom he likewise succeeded in swindling out of the partnership, thus ending up a wealthy man. After that he entered the manufacturing segment of the computer world and began producing equipments for his own chain of stores. From then on he contrived, by hook or by crook, to eliminate most of his competitors, forcing them out of the business by the most ruthless and dishonest means possible: industrial espionage, personnel raiding, labor unrest, and so on. Unfortunately for him, though, his unethical tactics eventually backfired against him. He was accused of breaking the copyright laws enshrined in the computer Software Act of 1980. Just before the date of the class homecoming around, he lost about everything he owned in a lawsuit. And so it was very chasten Charlie who faced Jonathan after their ten years’ separation.

The latter entered the business world with only one thing in mind: the service of the public. Being a deeply committed Christian, he had completely made his the teaching of Jesus on service: “you know that among the pagans the rulers lord it over them and their great man make their authority felt. This is not to happen among you. No; anyone who wants to be great among you must be your servant, and anyone who wants to be first among you must be your slave, just as the Son of Man came not to be served but to serve, and to give his life as a ransom for many” (Mt 20, 26-28).

And so, imbued with the sole concern of serving the public, he looked around for ways and means of achieving his aim. Now, it so happened that at the particular time a website developing company, Angels on Vines, was on the verge of bankruptcy. Jonathan bought it, put it back on its feet, and soon transformed it into the most thriving concern in the entire Websites industry expanding in the process into a vast network of branches and offices, worldwide. How the young man achieved all this was direct result of his idealism, integrity and profound respect for his employees (whom he always called “associates”). Here are some of the methods he used in this connection.

First of all, from the very first day of his takeover of Angels on Vines, he stressed quality. To his stockholders he said year after year: “Quality is the first word in our motto. Growth is not our principal goal. Our goal is to be quality organization and do a quality job, which means that we will be proud of our work and products for years to come. As we achieve quality, growth will come as a result.”
With Jonathan at the helm, Angels on Vines became obsessed with quality. You asked officials at the company’s headquarters about personnel, they would talk quality; you asked about sales, they would talk quality; you asked about management, they would talk quality.

In this respect Jonathan had a simple philosophy: he wanted to give the best company service of any company in the world. To this end Angels on Vines guaranteed answering any customers complain in twenty-four hours. Jonathan read every complaint Email personally and answered it personally. His company guaranteed quality websites in all over the country and the whole world.

Towards his personnel Jonathan always acted with the utmost respect and consideration. Thus he insisted that at all levels of the organization all members were made aware of their essential contribution to the overall success of Angels on Vines. They were to be treated as adults and as partners, with dignity and respect. This meant that employees, once they wholeheartedly shared the values of service and quality at the heart of the company’s working principles, were given a wide scope of practical autonomy to get the job done. New ideas and new forms of experimentation were welcome, all this with a high tolerance of failure for those who risked innovations. All important communications were made face to face. Workers were given opportunity for career education, security in their positions, and easy access to any superiors. Finally, employees received constant “positive reinforcement” by means of incentives and rewards of all kinds: pens badges, buttons, medals, a ten percent bonus for a week’s punctuality, a “gold circle” for top sales persons, special “jubilees” for outstanding performers, honorary stars for no-absence months, and so on. In other words Jonathan provided initiative, direction, meaning he created among his “associates” a sense of excitement, of exuberance, a sense of being part of the best, a sense of creating something of quality that they could be proud of. And they were. For indeed, as Jonathan often stated publicly: “At Angels on Vines, we only make Websites; but it’s the best in the world. And so, the public is served and God is honored.”

It is in such a context that Charlie and Jonathan met again. Naturally, the latter was far too considerate to remind his classmate of their erstwhile resolution to “compare notes” and, even less, of Charlie’s bet of tripling Jonathan’s worth. No, given his exquisitely Christian tact, Jonathan could not allow himself to gloat over his former classmate’s failure (even though richly deserved) or even allude to it.

This attitude of Jonathan took Charlie by surprise. He had expected at least a few oblique and ironical references to his fiasco. He got none. On the contrary, he sensed that Jonathan wasn’t in the least judgmental towards him, that he was in fact discreetly supportive and sympathetic. And this set him thinking. He had already begun to revise his entire philosophy of life, acknowledging that ruthless competition was unproductive in the long run. Perhaps, he mused, Jonathan’s approach was better than his? Anyway, it certainly worked better!

To cut short a long story, at the end of the homecoming Jonathan, sensing his classmate’s change of heart, graciously invited Charlie to come and work for him. The latter accepted with gratitude, aware that life – or was it God? - was giving him a second chance. He wouldn’t miss this one!



Saturday, March 15, 2008

Divine Mercy, Jesus I Trust in You

In this Holy week, I always remember to pray the novena of Divine Mercy, because I have a very long story of it which am going to share when asked personally, anyway I can post it on my blog, but not now, as I have so many things in my mind about PHP and MySQL ^_^ anyway the meaning of the image...
The two rays denote Blood and Water. the pale ray stands for the Water which makes souls righteous. The red ray stands for the Blood which is the life of souls. These two rays issued forth from the very depths of My tender mercy when My agonized heart was opened by a lance on the Cross. These rays shield souls from the wrath of My Father. Happy is the one who dwell in their shelter, for the just hand of God shall not lay hold of him. (Diary 299)

Not in the beauty of the color, nor of the brush, lies the greatness of this image, but in My grace. (Diary 313)

By means of this image I shall grant many graces to souls. It is to be a reminder of the demands of My mercy, because even the strongest faith is of no avail without works. (Diary 742)

and here we go...

The Novena:

Jesus asked that the Feast of the Divine Mercy be preceded by a Novena to the Divine Mercy which would begin on Good Friday. He gave St. Faustina an intention to pray for on each day of the Novena, saving for the last day the most difficult intention of all, the lukewarm and indifferent of whom He said:

"These souls cause Me more suffering than any others; it was from such souls that My soul felt the most revulsion in the Garden of Olives. It was on their account that I said: 'My Father, if it is possible, let this cup pass Me by.' The last hope of salvation for them is to flee to My Mercy."

In her diary, St. Faustina wrote that Jesus told her:

"On each day of the novena you will bring to My heart a different group of souls and you will immerse them in this ocean of My mercy ... On each day you will beg My Father, on the strength of My passion, for the graces for these souls."

First Day (Good Friday)

"Today bring to Me all mankind, especially all sinners,

and immerse them in the ocean of My mercy. In this way you will console Me in the bitter grief into which the loss of souls plunges Me."

Most Merciful Jesus, whose very nature it is to have compassion on us and to forgive us, do not look upon our sins but upon our trust which we place in Your infinite goodness. Receive us all into the abode of Your Most Compassionate Heart, and never let us escape from It. We beg this of You by Your love which unites You to the Father and the Holy Spirit.

Eternal Father, turn Your merciful gaze upon all mankind and especially upon poor sinners, all enfolded in the Most Compassionate Heart of Jesus. For the sake of His sorrowful Passion show us Your mercy, that we may praise the omnipotence of Your mercy for ever and ever. Amen.

Second Day (Holy Saturday) or Black Saturday

"Today bring to Me the Souls of Priests and Religious,

and immerse them in My unfathomable mercy. It was they who gave me strength to endure My bitter Passion. Through them as through channels My mercy flows out upon mankind."

Most Merciful Jesus, from whom comes all that is good, increase Your grace in men and women consecrated to Your service,* that they may perform worthy works of mercy; and that all who see them may glorify the Father of Mercy who is in heaven.

Eternal Father, turn Your merciful gaze upon the company of chosen ones in Your vineyard -- upon the souls of priests and religious; and endow them with the strength of Your blessing. For the love of the Heart of Your Son in which they are enfolded, impart to them Your power and light, that they may be able to guide others in the way of salvation and with one voice sing praise to Your boundless mercy for ages without end. Amen.

* In the original text, Saint Faustina uses the pronoun "us" since she was offering this prayer as a consecrated religious sister. The wording adapted here is intended to make the prayer suitable for universal use.

Third Day (Easter Sunday)

"Today bring to Me all Devout and Faithful Souls,

and immerse them in the ocean of My mercy. These souls brought me consolation on the Way of the Cross. They were a drop of consolation in the midst of an ocean of bitterness."

Most Merciful Jesus, from the treasury of Your mercy, You impart Your graces in great abundance to each and all. Receive us into the abode of Your Most Compassionate Heart and never let us escape from It. We beg this grace of You by that most wondrous love for the heavenly Father with which Your Heart burns so fiercely.

Eternal Father, turn Your merciful gaze upon faithful souls, as upon the inheritance of Your Son. For the sake of His sorrowful Passion, grant them Your blessing and surround them with Your constant protection. Thus may they never fail in love or lose the treasure of the holy faith, but rather, with all the hosts of Angels and Saints, may they glorify Your boundless mercy for endless ages. Amen.

Fourth Day (Easter Monday)

"Today bring to Me those who do not believe in God and those who do not know Me,

I was thinking also of them during My bitter Passion, and their future zeal comforted My Heart. Immerse them in the ocean of My mercy."

Most compassionate Jesus, You are the Light of the whole world. Receive into the abode of Your Most Compassionate Heart the souls of those who do not believe in God and of those who as yet do not know You. Let the rays of Your grace enlighten them that they, too, together with us, may extol Your wonderful mercy; and do not let them escape from the abode which is Your Most Compassionate Heart.

Eternal Father, turn Your merciful gaze upon the souls of those who do not believe in You, and of those who as yet do not know You, but who are enclosed in the Most Compassionate Heart of Jesus. Draw them to the light of the Gospel. These souls do not know what great happiness it is to love You. Grant that they, too, may extol the generosity of Your mercy for endless ages. Amen.

*Our Lord's original words here were "the pagans." Since the pontificate of Pope John XXIII, the Church has seen fit to replace this term with clearer and more appropriate terminology.

Fifth Day (Easter Tuesday)

"Today bring to Me the Souls of those who have separated themselves from My Church*,

and immerse them in the ocean of My mercy. During My bitter Passion they tore at My Body and Heart, that is, My Church. As they return to unity with the Church My wounds heal and in this way they alleviate My Passion."

Most Merciful Jesus, Goodness Itself, You do not refuse light to those who seek it of You. Receive into the abode of Your Most Compassionate Heart the souls of those who have separated themselves from Your Church. Draw them by Your light into the unity of the Church, and do not let them escape from the abode of Your Most Compassionate Heart; but bring it about that they, too, come to glorify the generosity of Your mercy.

Eternal Father, turn Your merciful gaze upon the souls of those who have separated themselves from Your Son's Church, who have squandered Your blessings and misused Your graces by obstinately persisting in their errors. Do not look upon their errors, but upon the love of Your own Son and upon His bitter Passion, which He underwent for their sake, since they, too, are enclosed in His Most Compassionate Heart. Bring it about that they also may glorify Your great mercy for endless ages. Amen.

*Our Lord's original words here were "heretics and schismatics," since He spoke to Saint Faustina within the context of her times. As of the Second Vatican Council, Church authorities have seen fit not to use those designations in accordance with the explanation given in the Council's Decree on Ecumenism (n.3). Every pope since the Council has reaffirmed that usage. Saint Faustina herself, her heart always in harmony with the mind of the Church, most certainly would have agreed. When at one time, because of the decisions of her superiors and father confessor, she was not able to execute Our Lord's inspirations and orders, she declared: "I will follow Your will insofar as You will permit me to do so through Your representative. O my Jesus " I give priority to the voice of the Church over the voice with which You speak to me" (497). The Lord confirmed her action and praised her for it.

Sixth Day (Easter Wednesday)

Today bring to Me the Meek and Humble Souls and the Souls of Little Children,

and immerse them in My mercy. These souls most closely resemble My Heart. They strengthened Me during My bitter agony. I saw them as earthly Angels, who will keep vigil at My altars. I pour out upon them whole torrents of grace. I favor humble souls with My confidence.

Most Merciful Jesus, You yourself have said, "Learn from Me for I am meek and humble of heart." Receive into the abode of Your Most Compassionate Heart all meek and humble souls and the souls of little children. These souls send all heaven into ecstasy and they are the heavenly Father's favorites. They are a sweet-smelling bouquet before the throne of God; God Himself takes delight in their fragrance. These souls have a permanent abode in Your Most Compassionate Heart, O Jesus, and they unceasingly sing out a hymn of love and mercy.

Eternal Father, turn Your merciful gaze upon meek souls, upon humble souls, and upon little children who are enfolded in the abode which is the Most Compassionate Heart of Jesus. These souls bear the closest resemblance to Your Son. Their fragrance rises from the earth and reaches Your very throne. Father of mercy and of all goodness, I beg You by the love You bear these souls and by the delight You take in them: Bless the whole world, that all souls together may sing out the praises of Your mercy for endless ages. Amen.

Seventh Day (Easter Thursday)

Today bring to Me the Souls who especially venerate and glorify My Mercy*,

and immerse them in My mercy. These souls sorrowed most over my Passion and entered most deeply into My spirit. They are living images of My Compassionate Heart. These souls will shine with a special brightness in the next life. Not one of them will go into the fire of hell. I shall particularly defend each one of them at the hour of death.

Most Merciful Jesus, whose Heart is Love Itself, receive into the abode of Your Most Compassionate Heart the souls of those who particularly extol and venerate the greatness of Your mercy. These souls are mighty with the very power of God Himself. In the midst of all afflictions and adversities they go forward, confident of Your mercy; and united to You, O Jesus, they carry all mankind on their shoulders. These souls will not be judged severely, but Your mercy will embrace them as they depart from this life.

Eternal Father, turn Your merciful gaze upon the souls who glorify and venerate Your greatest attribute, that of Your fathomless mercy, and who are enclosed in the Most Compassionate Heart of Jesus. These souls are a living Gospel; their hands are full of deeds of mercy, and their hearts, overflowing with joy, sing a canticle of mercy to You, O Most High! I beg You O God:

Show them Your mercy according to the hope and trust they have placed in You. Let there be accomplished in them the promise of Jesus, who said to them that during their life, but especially at the hour of death, the souls who will venerate this fathomless mercy of His, He, Himself, will defend as His glory. Amen.

*The text leads one to conclude that in the first prayer directed to Jesus, Who is the Redeemer, it is "victim" souls and contemplatives that are being prayed for; those persons, that is, that voluntarily offered themselves to God for the salvation of their neighbor (see Col 1:24; 2 Cor 4:12). This explains their close union with the Savior and the extraordinary efficacy that their invisible activity has for others. In the second prayer, directed to the Father from whom comes "every worthwhile gift and every genuine benefit,"we recommend the "active" souls, who promote devotion to The Divine Mercy and exercise with it all the other works that lend themselves to the spiritual and material uplifting of their brethren.

Eighth Day (Easter Friday)

"Today bring to Me the Souls who are in the prison of Purgatory,

and immerse them in the abyss of My mercy. Let the torrents of My Blood cool down their scorching flames. All these souls are greatly loved by Me. They are making retribution to My justice. It is in your power to bring them relief. Draw all the indulgences from the treasury of My Church and offer them on their behalf. Oh, if you only knew the torments they suffer, you would continually offer for them the alms of the spirit and pay off their debt to My justice."

Most Merciful Jesus, You Yourself have said that You desire mercy; so I bring into the abode of Your Most Compassionate Heart the souls in Purgatory, souls who are very dear to You, and yet, who must make retribution to Your justice. May the streams of Blood and Water which gushed forth from Your Heart put out the flames of Purgatory, that there, too, the power of Your mercy may be celebrated.

Eternal Father, turn Your merciful gaze upon the souls suffering in Purgatory, who are enfolded in the Most Compassionate Heart of Jesus. I beg You, by the sorrowful Passion of Jesus Your Son, and by all the bitterness with which His most sacred Soul was flooded: Manifest Your mercy to the souls who are under Your just scrutiny. Look upon them in no other way but only through the Wounds of Jesus, Your dearly beloved Son; for we firmly believe that there is no limit to Your goodness and compassion. Amen.

Ninth Day (Easter Saturday)

"Today bring to Me the Souls who have become Lukewarm,

and immerse them in the abyss of My mercy. These souls wound My Heart most painfully. My soul suffered the most dreadful loathing in the Garden of Olives because of lukewarm souls. They were the reason I cried out: 'Father, take this cup away from Me, if it be Your will.' For them, the last hope of salvation is to run to My mercy."

Most compassionate Jesus, You are Compassion Itself. I bring lukewarm souls into the abode of Your Most Compassionate Heart. In this fire of Your pure love, let these tepid souls who, like corpses, filled You with such deep loathing, be once again set aflame. O Most Compassionate Jesus, exercise the omnipotence of Your mercy and draw them into the very ardor of Your love, and bestow upon them the gift of holy love, for nothing is beyond Your power.

Eternal Father, turn Your merciful gaze upon lukewarm souls who are nonetheless enfolded in the Most Compassionate Heart of Jesus. Father of Mercy, I beg You by the bitter Passion of Your Son and by His three-hour agony on the Cross: Let them, too, glorify the abyss of Your mercy. Amen.

and finally go to church on The Feast Of Mercy
The first Sunday after Easter is the Feast of Mercy, but there must also be deeds of mercy, which are to arise out of love for Me. You are to show mercy to our neighbors always and everywhere. You must not shrink from this or try to absolve yourself from it. (Diary 742)


At three o'clock, or 15:00hrs implore My mercy, especially for sinners; and, if only for a brief moment, immerse yourself in My Passion, particularly in My abandonment at the moment of agony. This is the hour of great mercy ... In this hour I will refuse nothing to the soul that makes a request of Me in virtue of My Passion. (Diary 1320).

Here is the three o'clock prayer that I memorize:

You died Jesus but the source of life flowed out for souls and the ocean of mercy openned up for the whole world.

O fountain of life immeasurable Divine Mercy cover the whole world and empty yourself upon us.
O blood and water which flowed out from the heart of Jesus as a fountain of Mercy for us, I trust in you.

Holy God, Holy mighty one, Holy immortal one, have mercy on us and the whole world.
Holy God, Holy mighty one, Holy immortal one, have mercy on us and the whole world.
Holy God, Holy mighty one, Holy immortal one, have mercy on us and the whole world.

Jesus King of Mercy we trust in you.

source: The Divine Mercy Devotion

PS: I may be a catholic but am not what you call "segrado catholico" or very devoted catholic who goes to church every Sunday... I respect all religion, and have studied some of them ... that sometimes I believe in a little bit on some religion.
Anyway in short I BELIEVE IN ONE GOD, and I don't care much of what religion you are in as long as you have the faith in our good Lord God and respect that some days in the year are meant to be Holy.

My other interesting post:
Lessons in Life
The main causes of liver damage are:

Made Poems:
Day Shift adjustment
Day Shift adjustment Transformation =========> 50%
Day Shift adjustment Transformation =========> 100%
So Much to say but never took the time
Ang Malungkot na Tula (The Lonely Poem)
Don't give up
My Favorite Piece

How to Interpret Dreams?
What is Rebirth and Reincarnation?
How to have Lucid Dreaming/Dreams?

Movie Reviews Posts:
At last I have seen Transformers ^_^
Alvin and the Chipmunks Screenshots Overview
Iron Man Movie Review

Cute Post:
Cute Dog Tricks

Dreams...Panaginip... Nightmares


Wednesday, March 12, 2008

The 71st Araw ng Dabaw

March 17 Araw ng Davao... May 30% additional?

Hmmm Araw ng Davao week that started around March 10 to 17 culminate on the 16th weeeiii!!! our local holiday (Araw ng Dabaw / Kadayawan sa Dabaw) (^_^)
ano kaya meron kaya 30% additional?
hey sana mag comment naman kayo please please please
to know more about Araw ng Davao...The 71st Araw ng Dabaw (Davao Day) has evolved into a celebration of the Dabawe├▒os’ oneness. It is a vibrant feast held every March 16 and together with the Kadayawan, ranks as Davao City's biggest annual event.

This year’s theme is “Kasaysayan Balikan, Ihanda Kinabukasan.” (Learn from the Past, be ready for the Future)

This award is named after Datu Bago, a local chieftain who tried to repulse Spanish encroachment in Davao.

One of the highlights of the Araw ng Dabaw which will feature a musical band parade competition and showdown along the main streets of Davao City.

Davao's Official Beauty Pageant. Showcases some of the most beautiful women that the city has to offer.
As the only official tabulator of the Mutya ng Dabaw 2008, Digilution has also created a support website of the search for smart and talented Dabawenyas (

Digilution has also created various informative and effective websites for local and international companies, such as the Davao Business Directory, Kadayawan sa Dabaw Festival, Retirement Plantations, Hite Concrete, Grand Regal Hotel, John Gold Travel, BlueKnight Directory, Davao Doctors Hospital, Miss Teen Philippines, Pinoytel, Kasuotan, Jonnahrealty, GlitterWorks, Bongreen Corporation, African Asian Travel, Ayo Wonderoil, Crafters Haven Davao, Hismahills, Chateau del Mar Resort, Papa Lench, Eastbright, the newly reconstructed and improved Davao City Tourism website ( among many others.


Sunday, March 9, 2008

Busy Weekdays and Weekend

Nothing much to post except for the fact I'm very busy coping with PHP and MySQL
might as well post it here for my reference in this way I will not have a hard way of searching my documents etc..

Connecting To The Database

The first thing you must do before you can do any work at all is to connect to the MySQL database. This is an extremely important step as, if you are not connected, your commands to the database will fail.

Good practice for using databases is to specify the username, password and database name first so that if you change any of them at a later date you will only have to change one line:


At this point you may be wondering if it is a security risk, keeping your password in the file. You don't need to worry, though, because the PHP scource code is processed aby the server before being sent to the browser so it is impossible for the user to see the script's source.

Next, you will need to issue the command to start a database connection:


This line tells PHP to connect to the MySQL database server at 'localhost' (localhost means the server that the site is running one. Unless you web host tells you otherwise you should use localhost. If you are given a server address (such as you should replace localhost with "" (including the quotes)) using the username stored in $username and the password in $password.

Before I show you how to work with the database, I will show you one more command:


This is a very important command as it closes the connection to the database server. Your script will still run if you do not include this command but too many open MySQL connections can cause problems for a web host. It is good practice to always include this line once you have issued all your commands to the database, to keep the server running well.

Selecting The Database

After you have connected to the database server you must then select the database you wish to use. This must be a database to which your username has access. The following command:

@mysql_select_db($database) or die( "Unable to select database");

is used to do this. This tells PHP to select the database stored in the variable $database (which you set earlier). If it cannot connect it will stop executing the script and output the text:

Unable to select database

This extra 'or die' part is good to leave in as it provides a little error control but it is not essential.

Executing Commands

Now you have connected to the server and selected the database you want to work with you can begin executing commands on the server.

There are two ways of executing a command. One is to just enter the command in PHP. This way is used if there will be no results from the operation.

The other way is to define the command as a variable. This will set the variable with the results of the operation.

In this part of the tutorial we will use the first way as we are not expecting a response from the database. The command will look like this:


The useful thing about using this form of the command is that you can just repeat the same command over and over again without learning new ones. All you need to do is to change the variable.

Inserting Data

For this part of the tutorial I will return to the contacts database which we created in the last part. We will now add our first information to the database:

First: John
Last: Smith
Phone: 01234 567890
Mobile: 00112 334455
Fax: 01234 567891

This will all be put in with one command:

$query = "INSERT INTO contacts VALUES ('','John','Smith','01234 567890','00112 334455','01234 567891','','')";

This may look a little confusing at first so I will explain what it all means.

Firstly $query= is there because we are assigning this to the variable $query (see the section above). The next part:


is quite easy to understand. It tells the PHP to insert into the table called contacts the values in the brackets which follow.

The part in the brackets contains all the information to add. It uses all the fields in order and inserts the information from between the quotes. For example:


will be inserted into the 2nd field which, in this table, is the 'first' field.

You may have noticed that you are not inserting any value into the first field in the database (id). This is because this field is going to act as an index field. No two records in the database will have the same ID. Because of this, when we set up the database we set ID to 'Auto Increment'. This means that if you assign it no value it will take the next number in the series. This means that this first record will have the ID 1.

HTML Input

Inputing the data using HTML pages is almost identical to inserting it using a PHP script. The benefit, though, is that you do not need to change the script for each piece of data you want to input and you can also allow your users to input their own data.

The following code will show an HTML page with textboxes to enter the appropriate details:

First Name:

Last Name:






This page could, of course, be formatted and have other changes made to it. It is just a basic form to get you started. Next you will need to edit the script from last week. Instead of using information to input into the database, you will instead use variables:


@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO contacts VALUES ('','$first','$last','$phone','$mobile','$fax','$email','$web')";


This script should then be saved as insert.php so that it can be called by the HTML form. It works because, instead of the data being entered locally, it is being entered into the form and stored in variables which are then passed to the PHP.

You could also add to this script a message confirming the data input. This is basic PHP, though, and you should read the PHP tutorial if you do not know how to do this.

Outputting Data

Now you have at least one record, if not many more, in your database you will be wanting to know how you can output this data using PHP. Before beginning, though you should be familiar with loops in PHP (you can find out about them in the tutorial on Free Webmaster Help) as they are used for this way of outputting data.

The first command you will need to use is a MySQL query made up like this:

SELECT * FROM contacts

This is a basic MySQL command which will tell the script to select all the records in the contacts table. Because there will be output from this command it must be executed with the results being assigned to a variable:

$query="SELECT * FROM contacts";

In this case the whole contents of the database is now contained in a special array with the name $result. Before you can output this data you must change each piece into a separate variable. There are two stages to this.

Counting Rows

Before you can go through the data in your result variable, you must know how many database rows there are. You could, of course, just type this into your code but it is not a very good solution as the whole script would need to be changed every time a new row was added. Instead you can use the command:


This will set the value of $num to be the number of rows stored in $result (the output you got from the database). This can then be used in a loop to get all the data and output it on the screen.

Setting Up The Loop

nYou must now set up a loop to take each row of the result and print out the data held there. By using $num, which you created above, you can loop through all the rows quite easily. In the code below, $i is the number of times the loop has run and is used to make sure the loop stops at the end of the results so there are no errors.

while ($i < $num) {



This is a basic PHP loop and will execute the code the correct number of times. Each time $i will be one greater than the time before. This is useful, as $i can be used to tell the script which line of the results should be read. As the first line in MySQL output is 0, this will work correctly.

Assigning The Data To Variables

The final part of this output script is to assign each piece of data to its own variable. The following code is used to do this:


So to take each individual piece of data in our database we would use the following:


We do not need to get the ID field (although we could have done) because we have no use for it in the current output page.

Combining The Script

We can now write a full script to output the data. In this script the data is not formatted when it is output:


@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM contacts";



echo "
Database Output


while ($i < $num) {


echo "$first $last
Phone: $phone
Mobile: $mobile
Fax: $fax
E-mail: $email
Web: $web



Formatting Output

In the last part of the tutorial we output a list of all the people stored in the database. This just gave us a very basic output, though and is not particularly useful for a working website. Instead, it would be better if we could format it into a table and display it like this.

Doing this formatting is not particularly complicated. All you need to do is use PHP to output HTML and include your variables in the correct spaces. The easiest way to do this is by closing your PHP tag and entering the HTML normally. When you reach a variable position, include it as follows:

in the correct position in your code.

You can also use the PHP loop to repeat the appropriate code and include it as part of a larger table. For example, using a section of the code from part 4 which looped to output the database you can format it to display it in one large table:


while ($i < $num) {


echo "
Name Phone Mobile Fax E-mail Website
E-mail < /a> Website


This code will print out table headers, then add an extra row for each record in the database, formatting the data as it is output.

As long as you are familiar with PHP and HTML the code is probably pretty self explanatory but I will just point out the last two lines in the table, for example:


This shows one of the useful features of using PHP to include MySQL data as you can use it to output parts of your code and make pages fully dynamic.

Selecting Pieces of Data

As well as showing the whole database, PHP can be used to select individual records, or records which match certian criteria. To do this you must use a variation of the SELECT query. To display the whole table we used the query:

SELECT * FROM contacts

If we just wanted to select ones who had the first name 'John' you would use the following query:

SELECT * FROM contacts WHERE first='john'

As with other MySQL queries, it is almost like plain english. In the same way you could select records based on any field in the database. You can also select ones with more than one field by adding more:


sections onto the query.

Although I won't go int
o great depth about it in this section, you can also use variables to give the database criteria. For example, if you had a search form you could get the last name people wanted to search for and store it in a variable called $searchlast. Then you could execute the following piece of code:

$query="SELECT * FROM contacts WHERE last='$searchlast'";

Please note that at the end of the first line there is a ' followed by a " before the semicolon.


At this point it should be noted that you must be very careful in using the technique given above. Without correct secuirty measures, it would be very easy for someone to access data on your server, or even make changes to the database. This can occur if the user sets the variable to a value which edits the SQL string being generated in such a way that it can be used for their own purposes. I won't go into full details here, but there are many websites which give full details (search for 'sql injection attack').

This security hole is easy to plug with a bit of work. Always check input data for invalid chanracters and use PHP's built in functions to remove control characters and HTML code etc. Again, there are many websites which go into this in depth.

* * *

Error Trapping

By outputting all the information from the database, it is quite unlikely that there will be no data, but if you allow updating and deleting of records, it is certainly a possibility. Luckily, with PHP and MySQL, there is an easy way round this using:


where $result contains the result of a query on the database (like selecting all the records). As I expalined before, this will set the value of $num as the number of rows in the result (and it was used in a loop in part 4). Because of this you can make a simple error trap using an IF statement:

if ($num==0) {
echo "The database contains no contacts yet";
} else {
Output Loop


You can expand on this more by making it more user friendly (for example by providing a link to the Add Data page if no contacts exist).

Ordering Data

Not only can you output data based on the contents of a field, but you can also order the output based on a field (for example placing users in alphabetical order). By default, the output from your queries will be in order of the id field, going from 1 upwards. You can sort it on any field, though.

For example, a useful sort would be to place all the users in alphabetical order based on their last name. For those not familiar with standard databases, this would be in Ascending order as it goes from A to Z. (Ascending order is also for 1-10 etc. and descending order provides Z to A and 10-1). To do this you would use the following query:

SELECT * FROM contacts ORDER BY last ASC

You could also use DESC to order the data in Descending order.

More Uses Of mysql_numrows and Sorting

The value you have assigned to $num is very imiportant as, apart from error trapping and loops, it has many other uses. An example of this would be to print out only the last 5 records added to a database. Firstly, they would need to be placed into order based on the id field (as the one with the latest ID would have been added last. This would require them to be in Descending order.

Now you have them in order of newest to oldest but this does not restrict the script to only showing the first 5. To do this, you would need to set your loop to run to 5 instead of $num (as this would only run the loop 5 times so only 5 records would be output).

Of course, before doing this, it would be important to check that $num was greater than 5, as if you ran the loop 5 times and there were only 3 rows you would get an error. This is easy to do though and the following code is an example of the sort of thing you would want to have:

if ($num>5) {

while ($i < $to) {


This code would check if there were more than 5 rows in the database. If there were, the loop would be set to run 5 times. If there were less than 5 rows the loop would run the correct number of times to output the whole database.

The ID Field

If you remember back to creating the database for the contacts at the beginning of this tutorial, you will remember that we included a numerical field called id. This field was set as auto_increment as well as being the primary field. I have already explained how this field is unique for every single record in the database, but I will now take this a stage further by explaining how this can be used to select an individual record from a database.

Selecting A Single Record

At the end of the last part of this tutorial, I s
howed you how to select records from the database based on the contents of partiular fields using:

SELECT * FROM contacts WHERE field='value'

Now, by using the unique ID field we can select any record from our database using:

SELECT * FROM contacts WHERE id='$id'

Where $id is a variable holding a number of a record. This may seem to be a little worthless as it is, but you can use this very effectively in a number of different ways. For example, if you wanted to have a dynamically generated site run through a database and a single PHP script, you could write the script to include the database data into the design. Then, using the id field, you could select each individual page and put it into the output. You can even use the page's URL to specify the record you want e.g.

And then have the PHP script look up the record with the id corresponding to $item, which in this case would be 7393

Links For Single Records

Using this method of choosing a record using the URL to select the record can be expanded further by generating the URL dynamically. This sounds a bit complicated so I will elaborate. In the contacts script we are writing, I will be showing you how to create an Update page where the user can update the contact details.

To do this, another column will be included in the output column, with an Update link in it. This update link will point to a page allowing the user to update the record. To select the record in this page, we will put:


By getting the id of the record along with the other information when we are outputting the information from the database, this code will create a link which has each record's ID number in it. Then, on the update page, there can be code to just select this item.

The Update Script

By using the $id variable you output links which would pass the correct ID to the script so that it can update the database. Using this you can then create the update script, which will actually have two sections to it.

Displaying The Update Page

The first part of the update script uses the single record selection from last week but adds a little HTML to it to make it more useful. First of all, we connect to the database and select the appropriate record.


$query=" SELECT * FROM contacts WHERE id='$id'";

while ($i < $num) {

Space For Code


Where 'Space For Code' is in this script is where the code for the update page will go. This is, in fact, just HTML formatting for the output:

First Name:

Last Name:

Phone Number:

Mobile Number:

Fax Number:

E-mail Address:

Web Address:

As you can see, this code will output a standard form, but instead of having blank boxes like on the form for inserting a new record, this one already has the current information from the database inserted into it. This makes it much more effective for an update script.

Updating The Database

The next stage of this script is to actually update the database. This is a simple operation and just involves a new query for the database:

$query = "UPDATE contacts SET first = '$ud_first', last = '$ud_last', phone = '$ud_phone', mobile = '$ud_mobile', fax = '$ud_fax', email = '$ud_email', web = '$ud_web' WHERE id = '$ud_id'";

This query tells the database to update the contacts table where the ID is the same as the value stored in $ud_id (which as you can see from the form on the previous page was set as the id of the record we are updating) and to set the following fields to the specified values (which were set using the form on the previous page).

This query could then be integrated into a simple script:



$query="UPDATE contacts SET first='$ud_first', last='$ud_last', phone='$ud_phone', mobile='$ud_mobile', fax='$ud_fax', email='$ud_email', web='$ud_web' WHERE id='$ud_id'";
echo "Record Updated";

This code would update the database and give the user a confirmation.

Deleting Records

The final part of the contacts database which needs to be created is a page to delete records. As with the Update page, this should have a record ID sent to it in the URL e.g.:


The code to do this is the same as to update the database, except with a slightly different MySQL query. Instead of the UPDATE query you should use:

DELETE FROM contacts WHERE id='$id'

This would then be used with the connection and confirmation code as above.


At this time it seems appropriate to mention another use of loops with a database. As well as using a loop to get information from a database as we have before, you can also use loops to execute queries. For example, if you wanted to change all the records in the database with the last name Smith to have the website

Standard Database Connection Code

$query=" SELECT * FROM contacts WHERE last='Smith'";

while ($i < $num) {
$query1="UPDATE contacts SET web='' WHERE id='$id'";


Of course, this could have been achived far easier and quicker using:

$query1="UPDATE contacts SET web='' WHERE last='Smith'";

and no loop.

* * *

Saving Time

When creating complex scripts using databases you will find that the most common thing you are doing is connecting to a database. Because of this, you can actually save time by creating either a username/password file or a connection file. For example for a username/password file you would create a file called:

and put the following in it:


Replacing the appropriate sections. Then in your php files use the following code:




at the beginning. Then, you can use the variables $username, $password and $database throughout your scripts without having to define them every time. Also, if you ever change this information, for example if you move to another web host, there is only one file to change.

You can use the same principal to connect to the database, by putting the connection code in the file, but you must always be sure to close the connection in each file or you may have problems with your MySQL server.


A limited form of searching can also be performed on your database using a built in MySQL function. This is by using the LIKE function as follows:

SELECT * FROM tablename WHERE fieldname LIKE '%$string%'

To explain furhter, LIKE tells the database to perform its 'searching' feature. The % signs mean that any other data could appear in their place and $string would hold your search string. In this place could be a word or number as well e.g.:

LIKE '%piano%'

which would output any rows with piano in the specified field.

Similarly, you can leave out one of the % signs so that you can specify the position of the string e.g.:

LIKE 'piano%'

Will only output rows where the specified field begins with piano, so:

The piano is next to the table.

Would not show up.

The Finished Script

Throughout this tutorial I have given you pieces of code to make a contacts database script. You can download the full script as a zip file so that you can examine the code (see Related Links).


From this tutorial you should now know the basics of using PHP and MySQL together to create database-enabled websites and programs. Using databases with the web opens up a huge new selection of things you can do and can make a simple website much more powerful, saving time updating the site, allowing user interaction and feedback and much more.

Aice Made Poems:
Day Shift adjustment
Day Shift adjustment Transformation =========> 50%
Day Shift adjustment Transformation =========> 100%
So Much to say but never took the time
Ang Malungkot na Tula (The Lonely Poem)
Don't give up
My Favorite Piece
The main causes of liver damage are:

Cute Post:
Cute Dog Tricks
What is true happiness?
How to Interpret Dreams?


If you look into my eyes
will you see my love for you?
If you look at my lips
will you know it's meant for you?

Everything happens for reasons...
Every moment has its own seasons...

The right time will come,
we will be together for eternity,
The right moment will come
our bond shall be filled with God's Blessings and Security.

© Aice Nice Poems