Thursday, November 12, 2009

How to display all the reports or files in one directory, that have commmon substring in their name

How to display all the reports or files in one directory, that have commmon substring in their name http://localhost/reports/?P=DA*25000702001*.txt sample output for the above is: Index of /reports Name Last modified Size Description Parent Directory - DA-25000702001-1.txt 13-Nov-2009 12:34 9.1K DA-25000702001-2.txt 07-Nov-2009 17:05 1.9K DA-Shedule-25000702001-1.txt 13-Nov-2009 12:34 4.6K DA-Shedule-25000702001-2.txt 07-Nov-2009 17:05 2.1K HERE /?P=DA*25000702001*.txt is very important.

How to create photo slideshow using javascript and html

How to create photo slideshow using javascript and html

<html>
<head>
<script type="text/javascript">

var image1=new Image()
image1.src="http://localhost/DA/1.JPG"
var image2=new Image()
image2.src="http://localhost/DA/2.JPG"
var image3=new Image()
image3.src="http://localhost/DA/3.JPG"
var image4=new Image()
image4.src="http://localhost/DA/4.JPG"
var image5=new Image()
image5.src="http://localhost/DA/5.JPG"
var image6=new Image()
image6.src="http://localhost/DA/6.JPG"
var image7=new Image()
image7.src="http://localhost/DA/7.JPG"


</script>
</head>
<body>

<img src="1.JPG" name="slide" border="0" width="900" height="900" />
<script type="text/javascript">
<!--
var step=1
var whichimage=1
function slideit()
{
if (!document.images)
return
document.images.slide.src=
eval("image"+step+".src")
whichimage=step
if (step<7)
step++
else
step=1
setTimeout("slideit()",5400)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="link1.htm"
else if (whichimage==2)
window.location="link2.htm"
else if (whichimage==3)
window.location="link3.htm"
}
//-->
</script>
</body>
</html>

Tuesday, November 10, 2009

Code to retrieve data from database and display it in excel or MS word

Code to retrieve data from database and display it in excel or MS word

<?php
class example
{
function example($params,$tpl)
{
include("connection.php");
$ab="select ename,cdate from exams";
$ab1=$con->Execute($ab);
$s=0;

    while(!$ab1->EOF)
    {
       $as[$s]=$ab1->fields[0];   
       $aa[$s]=$ab1->fields[1];

       $s++;
       $ab1->MoveNext();
    }

//print_r($aa);

header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=excelfile.xls");
header("Pragma: no-cache");
header("Expires: 0");
echo $header;
echo "<table border='0'></tr><td>ename</td><td>date</td></tr>";
for($i=0;$i<=sizeof($as);$i++)
    {
echo "<tr><td>".$as[$i]."</td><td>".$aa[$i]."</td></tr>";
}
echo "</table>";
}
?>


The fields which are marked as red are very important.

How to go previous page History.go(-1).. using javascript ..


To go previous page History.go(-1).. using javascript ....

            echo "<a href=javascript:history.go(-1)>Back</a>";

How to pass JavaScript variables to PHP --- How to use javascript variables in PHP Code


How to pass JavaScript variables to PHP --- How to use javascript variables in PHP Code

Passing JavaScript variables to PHP

Using javascript variables in PHP Code
<script type="text/javascript">

width = screen.width;
height = screen.height;

if (width > 0 && height >0) {
    window.location.href = "http://localhost/main.php?width=" + width + "&height=" + height;
} else
    exit();

</script>

<?php
echo "<h1>Screen Resolution:</h1>";
echo "Width  : ".$_GET['width']."<br>";
echo "Height : ".$_GET['height']."<br>";
?>

PHP Leading Zero for Double Digit Numbers -- Padding a Number with zeros


<?php
for ($num = 1; $num <= 31; $num++)
{
$day = sprintf("%02d", $num);
echo "<p>$day</p>";
}

PHP Leading Zero for Double Digit Numbers


Add a leading zero to a single digit integer



--
******************************************************
http://www.venkatmails.blogspot.com/

When you hire people who are smarter than you , you prove you are smarter than them.  
-------------------------------------------------
"If you open your heart, love opens your mind."
-------------------------------------------------
"Begin with an end in mind"
-------------------------------------------------
"Never make the same mistake twice ,there are so many new ones to make...Good day!"
-------------------------------------------------
Try to be serious! Why? Not to hurt others feelings
How about treating others, the way you'd wanna be treated.
Fine, don't be a fuddy duddy!

http://www.venkatmails.blogspot.com/
******************************************************