Posts

Showing posts from November, 2012

select all data between two dates using mysql

SELECT * FROM `product` WHERE (createdate BETWEEN '2012-11-19 14:15:55' AND '2012-11-29 21:58:43'); Hope enjoy:)

htaccess allow access php specific file

<Files ~ "^piwik\.(js|php)|robots\.txt$">     Allow from all     Satisfy any </Files>

how to post data to other page using javascript and php

<script  language="javascript"> function postdatasend(data){ var pnamevalue=document.getElementById('prname'+data).value; var ppricevalue=document.getElementById('prprice'+data).value; var mapForm = document.createElement("form");     mapForm.target = "Map";     mapForm.method = "POST"; // or "post" if appropriate     mapForm.action = "showsingleproduct.php";     mapForm.target='_self'; var pname = document.createElement("input");     pname.type = "hidden";     pname.name = "proname";     pname.value = pnamevalue;        mapForm.appendChild(pname);     var pprice = document.createElement("input");     pprice.type = "hidden";     pprice.name = "proprice";     pprice.value = ppricevalue;        mapForm.appendChild(pprice);     document.body.appendChild(mapForm);     mapForm.submit(); return true; } </script> <input type="hidde

shopping.com api using php and xml parsing easily

#create a array pagination class page. <?php   class pagination   {     var $page = 1; // Current Page     var $perPage = 10; // Items on each page, defaulted to 10     var $showFirstAndLast = false; // if you would like the first and last page options.         function generate($array, $perPage = 10)     {       // Assign the items per page variable       if (!empty($perPage))         $this->perPage = $perPage;             // Assign the page variable       if (!empty($_GET['page'])) {         $this->page = $_GET['page']; // using the get method       } else {         $this->page = 1; // if we don't have a page number then assume we are on the first page       }             // Take the length of the array       $this->length = count($array);             // Get the number of pages       $this->pages = ceil($this->length / $this->perPage);             // Calculate the starting point       $this->start  = ceil(($this->page - 1) * $this->

how to add rows number using mysql query

select @ rownum :=@ rownum + 1 ‘rowid’ , p .* from menu p ,   ( SELECT @ rownum := 0 ) r order by id desc limit 10 ;

create dynamic main menu and sub menu using php and mysql

<?php CREATE TABLE `menu` (   `id` int(11) NOT NULL auto_increment,   `label` varchar(50) NOT NULL default '',   `link` varchar(100) NOT NULL default '#',   `parent` int(11) NOT NULL default '0',   `sort` int(11) default NULL,   PRIMARY KEY  (`id`)) ------------------------------------------------------------------------------------------------------ $mysql=mysql_connect('127.0.0.1','root',''); mysql_select_db('test',$mysql); function display_menu($parent, $level) {     $result = mysql_query("SELECT a.id, a.label, a.link, Deriv1.Count FROM `menu` a  LEFT OUTER JOIN (SELECT parent, COUNT(*) AS Count FROM `menu` GROUP BY parent) Deriv1 ON a.id = Deriv1.parent WHERE a.parent=" . $parent);     echo "<ul>";     while ($row = mysql_fetch_assoc($result)) {         if ($row['Count'] > 0) {             echo "<li><a href='" . $row['link'] . "'>" . $row[&

wordpress custom page title set

 how to set custom page title in wordpress <?php function add_custom_title() {          <title>call bikash page title</title> } add_action('wp_head','add_custom_title'); ?>