Export Database in excel

First of all you have to make a php script named as script.php

<?php
error_reporting(0);

function export_excel_csv()
{
$conn = mysql_connect("localhost","root","");

$db = mysql_select_db("database",$conn);

    $sql = "SELECT * FROM tablename";

    $rec = mysql_query($sql) or die (mysql_error());
   
    $num_fields = mysql_num_fields($rec);
   
    for($i = 0; $i < $num_fields; $i++ )
    {
        $header .= mysql_field_name($rec,$i)."\t";
    }
   
    while($row = mysql_fetch_row($rec))
    {
        $line = '';
        foreach($row as $value)
        {                                          
            if((!isset($value)) || ($value == ""))
            {
                $value = "\t";
            }
            else
            {
                $value = str_replace( '"' , '""' , $value );
                $value = '"' . $value . '"' . "\t";
            }
            $line .= $value;
        }
        $data .= trim( $line ) . "\n";
    }
   
    $data = str_replace("\r" , "" , $data);
   
    if ($data == "")
    {
        $data = "\n No Record Found!\n";                      
    }
   
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=reports.xls");
    header("Pragma: no-cache");
    header("Expires: 0");
    print "$header\n$data";
}

    export_excel_csv();
?>


Then you have to create a page from where you will call this funtion it may be php page or html page (index.html)
create a form with submit button use action with the script page

<form action="script.php">
<input type="submit" value="export">
</form>

Prev/Next Button to scroll through mysql database

//get the current value of "page" in your query string and scrub it to prevent SQL injection if (isset($_GET['page'])) 
{ 
    
$currentPage = mysql_real_escape_string($_GET['page']); 
} 
else 
{ 
    
$currentPage = 0; 
} 
//validate it and calculate values for the Next and Prev links if (ctype_digit($currentPage) && $currentPage >= 0) 
{ 
    
$nextPage = $currentPage + 1; 
    
$prevPage = $currentPage - 1; 
    
//You probably want to get fancier with this to disable the Prev link if you're at the top 
    
if ($prevPage < 0) 
    { 
        
$prevPage = 0; 
    } 
    
//You probably want to run a query here to see if $nextPage is past the end of your resultset } $nextLink = "<a href='http://yourwebpage.com?page=$nextPage'>Next</a>"; $prevLink = "<a href='http://yourwebpage.com?page=$prevPage'>Prev</a>"; 

echo $nextLink;
echo $prevLink;
//later on in the script when you're creating your HTML output, drop in the link variables  




$sql = "SELECT story, post_date FROM memberstories WHERE user_id='$id' ORDER BY post_date DESC LIMIT $page, 1"; $result = mysql_query(); //as always, check your query for errors! if (!$result) 
{ 
    die(
"Query Error! Query: $sql<br />Error: ".mysql_error()); 
}  

Add Custom Navigation Menu to Footer


First, you’ll need to register the new menu with WordPress. To do this, add the following code to your custom_functions.php file:


register_nav_menu('footer','Footer Menu');

function custom_footer_menu() {
  wp_nav_menu(array(
    'container' => '',
    'menu_id' => 'footer_nav',
    'fallback_cb' => 'thesis_nav_menu',
    'theme_location' => 'footer',
  ));
}
add_action('thesis_hook_footer','custom_footer_menu');  



Once this is done, you’ll go to Appearance > Menus, and build your new footer navigation menu.
First, click the + tab, assign a menu name (such as Footer Menu), then click the Create Menu button.
Then, add your desired items to the menu you just created – remember to click the Save Menu button when you’ve finished your selections!
Now, when you view your site, you’ll see your newly created footer menu in place at the bottom of the page!

How to submit a form when pressing Enter in a textarea

<script>
$(document).ready(function(){
$("textarea").keydown(function(e){
if (e.keyCode == 13 && !e.shiftKey)
{
  // prevent default behavior
  e.preventDefault();
document.forms[0].submit();
  //alert("ok");
  return false;
  }
});
});
</script>

Disable New Line in Textarea when Pressed ENTER

<script>
$(document).ready(function(){
$("textarea").keydown(function(e){
if (e.keyCode == 13 && !e.shiftKey)
{
  // prevent default behavior
  e.preventDefault();
  //alert("ok");
  return false;
  }
});
});
</script>