Showing posts with label like strstr php. Show all posts
Showing posts with label like strstr php. Show all posts

Friday, August 1, 2008

How to get the date from MySql TIMESTAMP column using php

In mysql you can use a TIMESTAMP type to store both date and time in a table column in this format YYYY-MM-DD HH:MM:SS
Sometimes you need to get only the date part from the TIMESTAMP.
You can use mysql date() function to do this


<?php

$today = date("Y-m-d"); //todays date

$query = "select * from tbl where DATE(c_timstp) = $today";

$result = mysql_query($query);

?>



Get Free Sinhala IT Learning Videos Kuppiya.com


Get custom programming done at GetAFreelancer.com!

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">
//visit kuppiya.com
var myKey = /kuppiya/;
var myStringVar = "I Love kuppiya";
var myMatch = myStringVar.search(myKey);
if(myMatch != -1)
{
alert("Wow There is a match "); 
}
else
{
alert("hmmm no match");
} 
</script>



Get custom programming done at GetAFreelancer.com!