Thursday, December 11, 2008

meta refresh problem in IE7

<meta equiv="Refresh" content="3;url=http://mysite.com">


this meta tag will redirect to the specified url in 3 seconds.
but it won't work in Internet Explorer 7.

BUT...
we can use a script...

<script language=JavaScript>

function Refresher(t) {
if(t) refresh = setTimeout("document.location='http://www.mysite.com';",
t*1000);
}

</script>

Then call it inside body tag..

<BODY onLoad="Refresher(20)">

Cheers!

Wednesday, December 10, 2008

php explode and implode

Use of Explode and implode functions

Explode - splits a string by a string
eg:
$a = explode("/","23/02/2008");
then
$a[0] = "23"
$a[1] = "02"
$a[2] = "2008"

Implode - joins array elements into string with a string

$b = implode("-",$a);
then
$b = "23-02-2008"


http://in.php.net/manual/en/function.explode.php
http://in.php.net/manual/en/function.implode.php

Getting Last generated auto increment value in mysql

Some tables have auto increment field.

after executing a insert command in mysql, sometimes we may want to know the last added value.... for that we can use
mysql_insert_id()
function

eg:
mysql_query($sql3); //executing some query
$last_num = mysql_insert_id(); //last added value


Cheers!