Wednesday 27 November 2013

Easy Way to create drop menu using Html,CSS and Jquery

I found a website with large collections of animated drop-down. It is free and very easy to use.
Check the below link. This will help you in your website development.

http://apycom.com

Sunday 24 November 2013

Read text file contents line by line

The following example shows, how to upload text file and read that uploaded file.And also insert the line by line text file contents  to MySQL Database.

Create a folder in your root, Here we named it as upload.In this folder we are uploading text file.

In you form html

    <html>
    <body>
    <table align="center">
    <form action="upload_page.php" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
    </form>
    </table>
    </body>
    </html>

And your upload_page.php

    <?php
    //upload file to upload folder
    $uploaddir = 'upload/';
    $uploadfile = $uploaddir . basename($_FILES['file']['name']);
    //if upload is success
    if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
    //read file
    $fp = fopen($uploadfile, 'rb');
    while ( ($line = fgets($fp)) !== false) {
    echo $line.'<br />';
    }
    } else {
    echo "Error in file upload";
    }
    ?>

Monday 11 November 2013

Bulk Jquery Animations

Hai Friends;

   You can find out bulk Jquery animations from one website, HTMLDRIVE. There are lot of animations and all are free. This website is very helpful for web developers/web designers
 Here, all animations are listed on the basis of category, like Image gallery,Menu & navigation etc.

Sunday 3 November 2013

Get Current Time With AM & PM Format Using Java Script

Use Following Code for to get current time with AM & PM format using JavaScript.
 
<div id="current_date_class"></div>


<script type="text/javascript">

    var currentDate = new Date();
    var hours = currentDate.getHours();
    var minutes = currentDate.getMinutes();
    var ampm = (hours>=12)?'pm':'am';
    hours = hours%12;
    hours = hours?hours:12;
    hours = hours<10?'0'+hours:hours;
    minutes = minutes<10?'0'+minutes:minutes;
    var time = hours+" : "+minutes+" "+ampm;
    document.getElementById("current_date_class").innerHTML=time;

</script>

Download MySQL Table Records To CSV File Using PHP

Try the following code for download mysql table records as CSV file.

<?php

mysql_connect("localhost", "root", "") or die("Connection failed! " . mysql_error());
mysql_select_db("database") or  die("Error in database connection " . mysql_error());


$output = "";
$table = ""; // Enter Your Table Name Here
$sql = mysql_query("select * from $table");
$total_columns = mysql_num_fields($sql);

// First you get all field names

for ($i = 0; $i < $total_columns; $i++) {
$heading = mysql_field_name($sql, $i);
$output .= '"'.$heading.'",';
}
$output .="\n";

// Get the all values from database

while ($row = mysql_fetch_array($sql)) {
for ($i = 0; $i < $total_columns; $i++) {
$output .='"'.$row["$i"].'",';
}
$output .="\n";
}

// Download the CSV file

$filename = "yourFileName.csv";
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename='.$filename);

echo $output;
exit;

?>

Friday 1 November 2013

Jquery Simple File Uploader (Plupload)

We are using Plup-uploader for file uploading.It is very easy to use and we can simply integrate it in to our web applications.

It is also works in almost all web browsers.We can upload all files using this up loader.They provide response after completing the upload, so we can set the uploaded image/file preview after upload without page refresh.

We can also upload multiple files in one click.

Uploader Link: Click Here