Why Wordpress? Wordpress Features Make WordPress Rocks!

WordPress being fastest growing CMS. Accordding estimate thosunds of new sites being developed world wide daily in the top 10 million websites. WordPress being the blogging platform employed by all of the bloggers by themselves domain. Some use other blogging software as well, but WordPress is most popular. The explanation for so much popularity of WordPress is nothing other compared to the distinguishing features it offers.

Glance at Wordpress several key benefits, through to create ecommerce or personal site.

Flexible : Three steps installation, user friendly interface and abundance of available tutorials make it the easiest blogging software to use.

Besides that it allows maximum customization, i.e. you can customization in whatever the way you want.

SEO: Friendly: Simple and customized [search engine friendly]URL structures, tags and sitemaps etc make a blog noticed more by search engines, and this is all what WordPress provides.

Availability Of Variety Of Designs & Plugins: One of the major advantage is the widely available plugins and themes, that make a newbie an expert even.

Spam Control: The best feature of WordPress is that in association with Akismet, it provides the best spam control. In case if your domain is hit by spammers and you’re using WordPress, you don’t need to worry at all.

More than just a blog: WordPress Can Not Only Be Used For Blog, but also for a variety of purposes. It’s not only a blog but serves as a CMS [Content Management System], i.e. a news site etc.

There may be many other benefits that WordPress offers, but for that you must have to use it, you’ll get an idea yourself that what you can make of it!
Share:

Hit counter

A hit counter will let us know how many times a page is accessed. In case one visitors loads the page several times, the hit counter will increase several times (but this is likely to happen only a few times).

The code for the hit counter bellow will save the number of hits in a file named counter.txt (the name of this file may be changed). Each time the page is loaded, the file will be read, the number will be increased by one and the new number will be saved to the same file.

counter.php

<?php

//The file where number of hits will be saved; name may be changed; p.e. "/counter_files/counter1.txt"
$counterfile = "counter.txt";

// Opening the file; number of hit is stored in variable $hits
$fp = fopen($counterfile,"r");
$hits = fgets($fp,100);
fclose($fp);

//increading number of hits
$hits++;

//saving number of hits
$fp = fopen($counterfile,"w");
fputs($fp, $hits);
fclose($fp);

//printing  hits; you may remove next line (and keep the counter only for your records)
print $hits;

?>


To use this code, copy it to your page in the exact position where you want to show number of hits. If your page is a ".html" page, change the extension to ".php". Them, visit your page. In the first visit, you will get a couple of errors (the file where number of hits are recorded does not exists, so some errors will be shown in the page). Reload the page and you will see no errors. The hit counter will be working.

In case you want to use different hit counters for different pages, chage name of $counterfile for each page (p.e.: counter1.txt, counter2.txt, etc).  
Share:

Generate Php Form for mailing

 In this tutorial explain about 'How make mail form in Php?'. First of all you need a form, as for example the one in the table:

Form.html 

<FORM ACTION="formtomail.php" METHOD=post>

<!-- Your fields here -->

<INPUT TYPE=submit value="Submit">
</FORM> 

The Form Action must be directed to the PHP script bellow. you need the php script (copy the information in the table to a text file and save the file as "formtomail.php" in your server).

Formtomail.php 
<?
if ($_POST){
      // posted information is added to variable message
      $message="";
      foreach ($_POST as $formfieldname => $formfieldvalue){
            $message.="$formfieldname \n $formfieldvalue\n\n";     //
      }
     // send email with information from the form to
      mail("webmaster@mysite.com","Form to Mail", $message,"From: <webmaster@mysite.com>\nContent-Type: text/plain");
      print "The information has been send to webmaster";
}else{
      print "No information has been posted";
}
 
?> 

You need to customize the script: substitute red text in the script by your email. This scripts assumes you have no restrictions to use mail commnad.
Share:

Insert Data Using Php Mysql








For this, you are going to need to login to a MySQL server administration, such as ‘phpmyadmin‘. Contact your server host for more details. Copy and paste the follow MySQL code into your query panel. This show generate a database table called ‘my_table‘.
CREATE TABLE `my_table` (
`id` int(6) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default ”,
`email` varchar(255) NOT NULL default ”,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;


Build an HTML form to collect data

This takes us a little away from PHP and MySQL and back to simple HTML. Copy and paste the following into a document and label it as ‘add.php‘.

<form id=”FormName” action=”added.php” method=”post” name=”FormName”>
<table width=”448″ border=”0″ cellspacing=”2″ cellpadding=”0″>
<tr>
<td width = “150″ align=”right”><label for=”name”>Name</label></td>
<td><input id=”name” name=”name” type=”text” size=”25″ value=”" maxlength=”255″></td>
</tr><tr>
<td width = “150″ align=”right”><label for=”email”>E-mail</label></td>
<td><input id=”email” name=”email” type=”text” size=”25″ value=”" maxlength=”255″></td>
</tr><tr>
<td width=”150″></td>
<td>
<input type=”submit” name=”submitButtonName” value=”Add”></td>
</tr></table>
</form>

Capturing the form data with PHP

Now we need to capture the data sent via the form into a new page called ‘added.php‘ as specified within the top of our form. Add the following to ‘added.php‘. This page will now capture the to form item values of ‘name’ and ‘email’, as inputted by your visitor.


<?php
$name = $_POST['name']; /// Retrieve the value of ‘name’ from form
$email = $_POST['email'];/// Retrieve the value of ‘email’ from form
?>

Connecting to your MySQL database

Modify the following code in order to connect to your MySQL database and database tables with PHP. Many servers use ‘local_host’ as the host connector. If you are unsure, ask your server host. Replace the above with the following (added.php)
 

<?php
// Connection to MySQL database table
$my_db = mysql_connect(’local_host’, ‘my_username’, ‘my_password’);
$sel3Q = mysql_select_db(’my_database_name’, $my_db);
//

$name = $_POST['name']; /// Retrieve the value of ‘name’ from form
$email = $_POST['email'];/// Retrieve the value of ‘email’ from form
?> 
Now you have opened a connection to your MySQL database ‘my_database_name‘.

Add the data to the MySQL database with PHP

We will now need to tell the PHP to add this data to our MySQL database table. We will modify the above code with the following (added.php).


<?php
// Connection to MySQL database table
$my_db = mysql_connect(’local_host’, ‘my_username’, ‘my_password’);
$sel3Q = mysql_select_db(’my_database_name’, $my_db);
//

$name = $_POST['name']; /// Retrieve the value of ‘name’ from form
$email = $_POST['email'];/// Retrieve the value of ‘email’ from form

/// Add it to the database
$query = “INSERT INTO my_table (id, name, email)
VALUES (”, ‘$name’, ‘$email’ )”; /// the value of ‘id’ is left blank as it is set to ‘auto_increment’
$results = mysql_query($query); /// Process the above
///

if ($results) /// If it worked echo statement
{
echo “Details added.”;
}
else /// If it didn’t worked echo statement
{
echo “Didn’t work!!!”;
}

mysql_close(); /// Close connection with MySQL database – recommended!
?> 

As you can see from the above, the communication with the MySQL is sent via a string ‘$query’. The string is then passed through mysql_query tosend the contents of that string to the MySQL for processing.
Share:

Display Mysql data using Php Tutorial

Our First tutorial based on Display data from mysql table. Using PHP you can run a MySQL SELECT query to fetch the data out of the database. You have several options in fetching information from MySQL. PHP provide several functions for this. The first one is mysql_fetch_array()which fetch a result row as an associative array, a numeric array, or both.
Below codes is to using display record from table. Paste above codes in your editors.
>".mysql_error());

//count how many records found
$num=mysql_num_rows($rs);

if($num>0){ //check if more than 0 record found

echo "";
//start table             
//creating our table heading         
echo " ";             
echo "";             
echo "";             
echo "";         
echo "";                 
//retrieve our table contents         while($row=mysql_fetch_array($rs)){             //extract row             
//this will make $row['firstname'] to             
//just $firstname only             
extract($row);                         
//creating new table row per record             
echo "";                 
echo "";                 
echo "";                 
echo "";             
echo "";         }     
echo "
FirstnameLastnameUsername
{$firstname}{$lastname}{$username}
";//end table }else{ //if no records found echo "No records found."; } ?>

Our output will look like:

Now That's we have done!
Share: