Saturday, June 28, 2008

Search a String JavaScript - (Like strstr in php)

you want to search a keyword(String) within a given String using Javascript? need a function like strstr() in php? Then you should look at this code, like in php I haven't seen a built in function to do this but by using some regular expression you can accomplish this task

<script type="text/javascript">
var myKey = /kuppiya/;
var myStringVar = "I Love kuppiya";
var myMatch =;
if(myMatch != -1)
alert("Wow There is a match "); 
alert("hmmm no match");

Get custom programming done at!

Wednesday, June 25, 2008

How to make first letter uppercase (Capital) using PHP

You want to make your first letter in your string uppercase(Capital) using php?
have no fear you can use php built in function ucfirst()

$my_string = 'my kuppiya';
$my_string = ucfirst($my_string);

echo $my_string; //My kuppiya


If you like to learn about SLIIT please visit

 Subscribe To My Blog

Wednesday, June 18, 2008

How to refresh parent window when closing popup window

You open a popup and when a update done in popup window you need to refresh or reload the parent window. How can you reload or refresh your parent? here's how its done.

window.close(); // close the popup

if (window.opener && !window.opener.closed)
//if parent available
window.opener.location.reload(); //reload parent

 Subscribe To My Blog

Monday, June 16, 2008

How to get the MySql last inserted row using PHP?

When you use a auto increment primary key id field, you usually have no track of what is the current inserted id in the auto increment field. But there are situation where you need to know the last increamented id.
You can simply use mysql_insert_id()


mysql_query("insert into mytable (v_name) values ('kusal')");
$last_id = mysql_insert_id();

echo $last_id;


Freelance Jobs

Wednesday, June 11, 2008

How to get String Length in JavaScript

Getting String Length in JavaScript is pretty easy.
look at the following code:

var str_length = document.form1.textbox_name1.value;

alert(str_length.length); // get length

first store the text box value into a variable. then simply using the .length method you can get the string length.

Get custom programming done at!

Wednesday, June 4, 2008

How to select a random row from mysql table

Are you looking a way to get a random record from a mysql table?, want to do it by single and a simple query? if the answer is yes, here it is


You can use mysql rand() function to easily get a random data row.
but be warned that for large data tables this function is said to be slow.

If you like to learn more about SLIIT please visit

 Subscribe To My Blog

Tuesday, June 3, 2008

How to get a random number in PHP

Looking a way to generate a random number using a PHP function.
Here how it's done, pretty easy to get a random number


echo rand();


to see more options in rand() function visit

Get custom programming done at!