Tuesday, January 8, 2013

How to upload data from excel sheet to database using pHp

1.Save your excel sheet in .csv format.

2.add a form to upload file.

 addfile.php

<html>
<body>

<form action="uploadfile.php" method="post"
enctype="multipart/form-data">
<label for="file">Csv Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>

</body>
</html>

3.add a configuration file for connection with database.

config.php


<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "root";
$mysql_database = "your database name";
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Could not connect database");
mysql_select_db($mysql_database, $bd) or die("Could not select database");
?>

4.Now finally the upload script

uploadfile.php



<?
include('myconfig.php');

if (($handle = fopen($_FILES['file']['tmp_name'], "r")) !== FALSE) {
                               $counter = 0;
                               while (($data = fgetcsv($handle, 100000, ',','"')) !== FALSE) {
  $counter++;
  if($counter==1){
continue;
  }
// echo '<pre>';
//  print_r($data) ;
 $str = implode('\',\'',$data);
 $str1 = '\''.$str.'\'';

                                             $insertQuery="INSERT into  tb_patient values($str1)";
                                           //  echo $insertQuery;
                                             $q=mysql_query($insertQuery);
                                             if($q)
                                             {
echo "data entered successfully";
}
else
{
echo "query failed";
}
                                               }
                                     
                                       }
                                     
?>


Monday, January 7, 2013

Best Facebook widget for wordpress

fbf-facebook-page-feed-widget is easy to use and simple sidebar widget for fetching posts from fb fan pages.. Facebook page ID is enough to configure this widget. Free download : click here

  1. fbf-facebook-page-feed-widget screenshot 1Configuring widget in admin panel
  2. fbf-facebook-page-feed-widget screenshot 2 Example feed in fron end sidebar
  3. fbf-facebook-page-feed-widget screenshot 3 Example feed in fron end within content of a post (using shortcode).............Enjoy..

How to get a facebook fan page I.D. ?


First of all check, if your fanpage does not have any country or age restrictions, otherwise finding an ID could get MUCH more difficult. You can allways edit your fan page to no restrictions for few minutes and check the ID in this time.
Example: http://www.facebook.com/TheBigBangTheory
The only thing to do is to change “www” for “graph”, looks like this: http://graph.facebook.com/TheBigBangTheory and the ID is a first rmation:


Fan page ID

Enjoy!! ;)

Best social widget for wordpress site

To implement fb , twitter , linked in, google +, all in one.Extremely easy to use.Enjoy.,,:)


=== Social Media Badge Widget ===





 Download for free:click here