To insert a new record to the table you created in the previous page select the Insert link at the top of the page:
Saturday, 30 May 2015
Create a database with phpMyAdmin
You can create all of your database tables and queries using PHP code. But
before doing that, it's a good idea to get an understanding of just what it
is you'll be creating. If you're new to the world of databases, then here's
a simple primer.
A database is a way to store lots of information. You might want to store the
names and addresses of all your contacts, or save usernames and passwords for
your online forum. Or maybe customer information.
When you create a database, you're creating a structure like this:
What is a database and what do they look like?
A database is a way to store lots of information. You might want to store the
names and addresses of all your contacts, or save usernames and passwords for
your online forum. Or maybe customer information. When you create a database, you're creating a structure like this:
Getting values out of PHP functions
When you're creating your own functions, you may notice that they can be broken
down in to two categories: functions that you can leave, and just let them do
their jobs; and functions where you need to get an answer back. As an example,
here's the two different categories in action:
print ("Get on with it!");
$string_length = strlen($string_length);
$string_length = strlen($string_length);
Check for blank Textboxes with PHP
f you remember the script that we wanted to create earlier it was this:
- Get the text that a user entered in a textbox on a form
- Trim any blank spaces from the left and right of the text
- Check that what you have left is not a blank string
<?PHP
PHP Functions and Arguments
Arguments
Functions can be handed variables, so that you can do something with what's inside of them. You pass the variable over to your functions by typing them inside of the round brackets of the function name.
<?PHP
$error_text = "Error message";
display_error_message($error_text);
display_error_message($error_text);
function display_error_message($error_text) {
print $error_text;
PHP Functions
What is a Function?
A function is just a segment of code, separate from the rest of your code. You separate it because it's nice and handy, and you want to use it not once but over and over. It's a chunk of code that you think is useful, and want to use again. Functions save you from writing the code over and over. Here's an example.Suppose you need to check text from a textbox. You want to trim any blank spaces from the left and right of the text that the user entered. So if they entered this:
" Bill Gates
"
You want to turn it into this:Sorting PHP Array values
There may be times when you want to sort the values inside of an array. For
example, suppose your array values are not in alphabetical order. Like this
one:
$full_name = array();
$full_name["Roger"] = "Waters";
$full_name["Richard"] = "Wright";
$full_name["Nick"] = "Mason";
$full_name["David"] = "Gilmour";
$full_name["Richard"] = "Wright";
$full_name["Nick"] = "Mason";
$full_name["David"] = "Gilmour";
Geting Values from Arrays
Here's an example for you to try:
<?php
$seasons = array("Autumn", "Winter",
"Spring", "Summer");
print $seasons[0];
print $seasons[0];
?>
The array is the same one we set up before To get
at what is inside of an array, just type the key number you want to access.
In the above code, we're printing out what is held in the 0 position (Key) in
the array. You just type the key number between the square brackets of your
array name:
print $Array_Name[0];
How to Set up a PHP Array
First you type out what you want your array to be called ($Order_Number,
in the array above) and, after an equals sign, you type this:
You can use two basic methods to put something into an array.
array( );
So setting up an array just involves typing the word array followed by a pair
of round brackets. This is enough to tell PHP that you want to set up the array.
But there's nothing in the array yet. All we're doing with our line of code
is telling PHP to set up an array, and give it the name $Order_Number. You can use two basic methods to put something into an array.
PHP Arrays
You know what a variable is – just a storage area where you hold numbers
and text. The problem is, a variable will hold only one value. You can store
a single number in a variable, or a single string. An array is like a special
variable, which can hold more than one number, or more than one string, at a
time. If you have a list of items (like a list of customer orders, for example),
and you need to do something with them, then it would be quite cumbersome to
do this:
$Order_Number1 = "Black shoes";
The PHP break statement
There are times when you need to break out of a loop before the whole thing
gets executed. Or, you want to break out of the loop because of an error your
user made. In which case, you can use the break statement. Fortunately, this
involves nothing more than typing the word break. Here’s some not
very useful code that demonstrates the use of the break statement:
$TeacherInterrupts = true;
$counter = 1;
$counter = 1;
while ($counter < 11) {
PHP Do ... While loops
This type is loop is almost identical to the while loop except that the condition comes at the end:
do
statement
while (condition)
The difference is that your statement gets executed at least once. In a normal
while loop, the condition could be met before your statement gets executed.
PHP While Loops
Instead of using a for loop, you have the option
to use a while loop. The structure of a while loop is more simple than a for
loop, because you’re only evaluating the one condition. The loop goes round
and round while the condition is true. When the condition is false, the programme
breaks out of the while loop. Here’s the syntax for a while loop:
while (condition) {
statement
PHP For Loops
So what’s a loop then? A loop is something that goes round and round.
If I told you to move a finger around in a loop, you’d have no problem
with the order (unless you have no fingers!) In programming, it’s exactly
the same. Except a programming loop will go round and round until you tell it
to stop. You also need to tell the programme two other things - where to start
your loop, and what to do after it’s finished one lap (known as the update
expression).
You can programme without using loops. But it’s an awful lot easier with them. Consider this.
You want to add up the numbers 1 to 4: 1 + 2 + 3 + 4. You could do it like this:
You can programme without using loops. But it’s an awful lot easier with them. Consider this.
You want to add up the numbers 1 to 4: 1 + 2 + 3 + 4. You could do it like this:
$answer = 1 + 2 + 3 + 4;
US ready to send military trainers to Nigeria in Boko Haram fight
Abuja – The United States is prepared to send military trainers to Nigeria to help new President Muhammadu Buhari’s armed forces improve their intelligence gathering and logistics,Reuters reported yesterday,quoting a senior State Department official.
Strains between U.S. military advisers and the Nigerian army over human rights abuses and corruption under the Jonathan government undermined cooperation in efforts to counter the six-year-old Boko Haram insurgency.
Friday, 29 May 2015
PHP and HTML Checkboxes
Note one thing about the HTML checkbox elements: they all have different NAME
values (ch1, ch2 ch3, etc). When we coded for the Radio Buttons, we gave the
buttons the same NAME. That's because only one option can be selected with Radio
Buttons. Because the user can select more than one option with Checkboxes, it
makes sense to give them different NAME values, and treat them as separate entities
(but some advocate treating them just like Radio Buttons).
In your PHP code, the technique is to check whether each checkbox element has been checked or not. It's more or less the same as for the radio Buttons. First we set up five variable and set them all the unchecked, just like we did before:
In your PHP code, the technique is to check whether each checkbox element has been checked or not. It's more or less the same as for the radio Buttons. First we set up five variable and set them all the unchecked, just like we did before:
PHP and HTML Radio Buttons
Make sure you save your work as radioButton.php, as that's where
we're posting the Form – to itself.
To get the value of a radio button with PHP code, again you access the NAME
attribute of the HTML form elements. In the HTML above, the NAME of the Radio
buttons is the same – "gender". The first Radio Button has
a value of "male" and the second Radio Button has a value of female.
When you're writing your PHP code, it's these values that are returned. Here's
some PHP code. Add it to the HEAD section of your HTML:The HTML ACTION attribute and PHP
You don't have to submit your form data to the same PHP page, as we've been
doing. You can send it to an entirely different PHP page. To see how it works,
try this:
Create the following page, and call it basicForm2.php. This is your HTML. Notice the ACTION attribue.
Create the following page, and call it basicForm2.php. This is your HTML. Notice the ACTION attribue.
<html>
<head>
<title>A BASIC HTML FORM</title>
</head>
<head>
<title>A BASIC HTML FORM</title>
</head>
PHP Submit buttons
In the previous lesson you saw how to get text
from a textbox when a Submit button on a form was clicked. However, when you
first load the page the text still displays.
The reason why the text displays when the page is first loaded is because the script executes whether the button is clicked or not. This is the problem you face when a PHP script is on the same page as the HTML, and is being submitted to itself in the ACTION attribute.
The reason why the text displays when the page is first loaded is because the script executes whether the button is clicked or not. This is the problem you face when a PHP script is on the same page as the HTML, and is being submitted to itself in the ACTION attribute.
PHP and Text Boxes on HTML Forms
If you've been following along from the in the previous lesson
then your basicForm.php now has a METHOD and ACTION set. We're going
to use these to process text that a user has entered into a text box. The
METHOD attribute tells you how form data is being sent, and the ACTION
attribute tells you where it is being sent.
To get at the text that a user entered into a text box, the text box needs
a NAME attribute. You then tell PHP the NAME of the textbox you want to work
with. Our text box hasn't got a NAME yet, so change HTML TO THIS
PHP and the Submit Button of HTML Forms
The HTML Submit button is used to submit form data to the script mentioned
in the ACTION attribute. Here's ours:
<Form Name ="form1" Method ="POST" ACTION
= "basicForm.php">
So the page mentioned in the ACTION attribute is basicForm.php. To Submit this
script, you just need a HTML Submit button:
<INPUT TYPE = "Submit" Name = "Submit1"
VALUE = "Login">
PHP and the Action Attribute of HTML Forms
The Action attribute is crucial. It means, "Where do you want the form
sent?". If you miss it out, your form won't get sent anywhere. You can
send the form data to another PHP script, the same PHP script, an email address,
a CGI script, or any other form of script.
In PHP, a popular technique is to send the script to the same page that the form is on – send it to itself, in other words. We'll use that technique first, but you'll see both techniques in action.
In PHP, a popular technique is to send the script to the same page that the form is on – send it to itself, in other words. We'll use that technique first, but you'll see both techniques in action.
PHP and the Post Attribute of HTML Forms
<FORM NAME ="form1" METHOD ="POST"
ACTION = "">
The ?Submit1=Login part from the previous section is now gone! That is because
we used POST as the method. Using POST means that the form data won't get
appended to the address in the address bar for all to see. We'll use both
POST and GET throughout the book. But it depends on the project: if the data
is not sensitive then use GET, otherwise use POST.
PHP and the Method Attribute of HTML Forms
<FORM NAME ="form1" METHOD ="
" ACTION = "">
The Method attribute is used to tell the browser how the form information should be sent. The two most popular methods you can use are GET and POST. But our METHOD is blank. So change it to this:
The Method attribute is used to tell the browser how the form information should be sent. The two most popular methods you can use are GET and POST. But our METHOD is blank. So change it to this:
<FORM NAME ="form1" METHOD ="GET"
ACTION = "">
To see what effect using GET has, save your work again and then click the Submit
button on your form. You should see this:HTML Forms and PHP
If you know a little HTML, then you know that the FORM tags can be used to
interact with your users. Things that can be added to a form are the likes of
text boxes, radio buttons, check boxes, drop down lists, text areas, and submit
buttons. A basic HTML form with a textbox and a Submit button looks like this:
<html>
<head>
<title>A BASIC HTML FORM</title>
</head>
<body>
<html>
<head>
<title>A BASIC HTML FORM</title>
</head>
<body>
Full Text: President Muhammadu Buhari’s Inaugural Speech
The full text of Muhammadu Buhari’s inaugural speech.
I am immensely grateful to God Who Has preserved us to witness this
day and this occasion. Today marks a triumph for Nigeria and an occasion
to celebrate her freedom and cherish her democracy. Nigerians have
shown their commitment to democracy and are determined to entrench its
culture. Our journey has not been easy but thanks to the determination
of our people and strong support from friends abroad we have today a
truly democratically elected government in place.
PHP Booleans
A Boolean value is one that is in either of two states. They are known as True
or False values, in programming. True is usually given a value of 1, and False
is given a value of zero. You set them up just like other variables:
$true_value = 1;
$false_value = 0;
$false_value = 0;
PHP Logical Operators
As well as the PHP comparison operators you saw earlier, there's also something
called Logical Operators. You typically use these when you want to test more
than one condition at a time. For example, you could check to see whether the
username and password are correct from the same If Statement. Here's the table
of these Operands.
PHP Switch Statements
To see
how switch statements work, study the following code:
<?php
$picture ='church';
switch ($picture) {
case 'kitten':
print('Kitten Picture');
break;
break;
case 'church':
print('Church Picture');
break;
break;
}
PHP Less Than, Greater Than
The Less Than ( < ) and Greater Than ( > ) symbols come in quite handy.
They are really useful in loops (which we'll deal with in another section),
and for testing numbers in general.
Suppose you wanted to test if someone has spent more than 100 pounds on your site. If they do, you want to give them a ten percent discount. The Less Than and Greater Than symbols can be used. Try this script. Open up your text editor, and type the following. Save your work, and try it out on your server.
Suppose you wanted to test if someone has spent more than 100 pounds on your site. If they do, you want to give them a ten percent discount. The Less Than and Greater Than symbols can be used. Try this script. Open up your text editor, and type the following. Save your work, and try it out on your server.
<?PHP
PHP Not Equal To
PHP Not Equal To
In the previous you saw what Comparison
Operators were. In this lessons, we'll explore the Comparison Operator for
Not Equal To: !=.So open up your text editor, and add the following script:
<?PHP
$correct_username = 'logmein';
$what_visitor_typed = 'logMEin';
$what_visitor_typed = 'logMEin';
if ($what_visitor_typed != $correct_username) {
print("You're not a valid user of this site!");
PHP Comparison Operators
PHP Comparison Operators
You saw in the last section how to test what is inside of a variable. You used if, else … if, and else. You used the double equals sign (==) to test whether the variable was the same thing as some direct text. The double equals sign is known as a Comparison Operator. There a few more of these “operands” to get used. Here’s a list. Take a look, and then we’ll see a few examples of how to use them.
You saw in the last section how to test what is inside of a variable. You used if, else … if, and else. You used the double equals sign (==) to test whether the variable was the same thing as some direct text. The double equals sign is known as a Comparison Operator. There a few more of these “operands” to get used. Here’s a list. Take a look, and then we’ll see a few examples of how to use them.
PHP if ... else if Statements
PHP if ... else if Statements
The Syntax of if…else if is as follows………
If (condition){
Print (“out put”);}
if ... else Statements in PHP
The syntax for the if else statement is this:
if (condition_to_test) {
}
else {
else {
}
If you look at it closely, you’ll see that you have a normal If Statement
first, followed by an “else” part after it. Here’s the “else”
part:
else {
}
Again, the left and right curly brackets are used. In between the curly brackets,
you type the code you want to execute. In our code, we set up two variables:
$kitten_image = 0;
$church_image = 1;
$church_image = 1;
PHP If Statements
You saw in the last section that variables are storage areas for your text
and numbers. But the reason you are storing this information is so that you
can do something with them. If you have stored a username in a variable, for
example, you'll then need to check if this is a valid username. To help you
do the checking, something called Conditional Logic comes in very handy indeed.
In this section, we'll take a look at just what Conditional Logic is. In the
next section, we'll do some practical work.
Thursday, 28 May 2015
Wednesday, 27 May 2015
quranic verses on shirk[1]
quranic verses on shirk[1]
SURA 24 - AL-NOOR
1
Sura 24 aya 55:
Allah has promised those of
you who believe and do good deeds that He will most surely make them
vicegerent in the earth as He made their ancestors before them, and that He will establish for them their
religion, the one which He
has chosen for them, and that He will change their present state of fear into
HEIFER
HEIFER
Allah the Almighty says:
{And (remember) when Musa (Moses) said to his people: "Verily,
Allah commands you that you slaughter a cow." They said, "Do you
make fun of us?" He said, "I take Allah's Refuge from being among Al-
Jahilun (the ignorant or the foolish). " They said, "Call upon your Lord
for us that He may make plain to us what it is!" He said, "He says:
The Elephant
The Elephant
Allah the Almighty says:
{Have you (0 Muhammad (Peace be upon him)) not seen how your
Lord dealt with the owners of the Elephant? [The Elephant army which
came from Yemen under the command of Abraha Al-Ashram intending
to destroy the Ka`bah at Makkah]. Did He not make their plot go
astray? And He sent against them birds, in flocks. Striking them with
stones of Sijjil (baked clay). And He made them like (an empty field on
People of the Cave
People of the Cave
Allah the Almighty says:
{Do you think that the people of the Cave and the Inscription (the
news or the names of the people of the Cave) were a wonder among
Our Signs? (Remember) when the young men fled for refuge (from
their disbelieving folk) to the Cave. They said: "Our Lord! Bestow on us
mercy from Yourself, and facilitate for us our affair in the right way!"
Therefore, We covered up their (sense of) hearing (causing them to go
Qaroon
Qaroon
The Story of Qarun(Korah)
Allah the Almighty says:
{Verily, Qarun (Korah) was of Musa's (Moses) people, but he
behaved arrogantly towards them. And We gave him of the treasures,
that of which the keys would have been a burden to a body of strong
men. Remember when his people said to him: "Do not exult (with
Bilkis [Queen of Sheba]
Bilkis [Queen of Sheba]
Allah the Almighty says:{He inspected the birds, and said: "What is the matter that I see
not the hoopoe? Or is he among the absentees? "I will surely punish
him with a severe torment, or slaughter him, unless he brings me a
clear reason." But the hoopoe stayed not long: he (came up and) said:
"I have grasped (the knowledge of a thing) which you have not
Harut and Marut
Harut and Marut
Allah the Almighty says:{They followed what the
Shayatin (devils) gave out (falsely of the
magic) in the lifetime of Sulaiman (Solomon). Sulaiman did not
disbelieve, but the Shayatin (devils) disbelieved, teaching men magic
and such things that came down at Babylon to the two angels, Harut
and Marut but neither of these two (angels) taught anyone (such
magic) in the lifetime of Sulaiman (Solomon). Sulaiman did not
disbelieve, but the Shayatin (devils) disbelieved, teaching men magic
and such things that came down at Babylon to the two angels, Harut
and Marut but neither of these two (angels) taught anyone (such
Habil and Qabil “Able and Cain”
Habil and Qabil “Able and Cain”
The First Crime on Earth
Allah the Almighty says:
{And (O Muhammad (Peace be upon him» recite to them (the
Jews)
the story of the two sons of Adam (Habil and Qabil) in truth;
when each
offered a sacrifice (to Allah), it was accepted from
the one
but not from the other. The latter said to the former: "I will surely
kill
ABU UBAIDAH IBN AL-JARRAH
ABU UBAIDAH IBN AL-JARRAH
His appearance was
striking. He was slim and tall. His face was bright and he had a sparse beard.
It was pleasing to look at him and refreshing
to meet him. He was
extremely courteous and humble and quite shy. Yet in a tough situation he would
become strikingly serious and alert,
resembling the flashing
blade of a sword in his severity and sharpness.
He was described as the Amin
or Custodian of Muhammad's community. His full name was Aamir ibn Abdullah ibn
al-Jarrah. He was known as Abu
Umm Salmah
Umm Salamah! What an eventful life she had! Her real name was Hind. She was the
daughter of one of the notables in the Makhzum clan
nicknamed "Zad
ar-Rakib" because he was well known for his generosity particularly to
travelers. Umm Salamah's husband was Abdullah ibn
Abdulasad and they
both were among the first persons to accept Islam. Only Abu Bakr and a few
others, who could be counted on the fingers of
Ramlah Bint Abu Sufyan
Ramlah Bint Abu Sufyan
Abu Sufyan ibn Harb could not conceive of anyone among the Quraysh who would
dare challenge his authority or go against his orders. He was
after all, the
sayyid or chieftain of Makkah who had to be obeyed and followed.
His daughter,
Ramlah, known as Umm Habibah, however dared to challenge his authority when she
rejected the deities of the Quraysh and their
Tuesday, 26 May 2015
Abu Dharr Al-Ghifari
Abu Dharr
Al-Ghifari
In the Waddan valley which connects Makkah with the outside world, lived the
tribe of Ghifar. The Ghifar existed on the meagre offerings of the
trade caravans of the
Quraysh which plied between Syria and Makkah. It is likely that they also lived
by raiding these caravans when they were |
Asmah Bint Abubakar
Asmah Bint Abubakar
Asmaa bint Abu
Bakr belonged to a distinguished Muslim family. Her father, Abu Bakr, was a
close friend of the Prophet and the first Khalifah after
his death. Her
halfsister, Aishah, was a wife of the Prophet and one of the Ummahat
al-Mumineen. Her husband, Zubayr ibn al-Awwam, was one
Aisha Bint Abubakar
The life of
Aishah is proof that a woman can be far more learned than men and that she can
be the teacher of scholars and experts. Her life is
also proof that a
woman can exert influence over men and women and provide them with inspiration
and leadership. Her life is also proof that