simple search highlite

php No Comments »

Read the rest of this entry »

Amount in words (in Latvian) – php

php 1 Comment »

Read the rest of this entry »

every second record

php No Comments »
<?
 $i=0;
 while ($i <= 10){
   $i++;
   if($i%2==0){ echo $i."=second<br>"; };
 }
?>

get week day

php No Comments »
<?
$date=date("Y-m-d");

function getweekday($date){
  $pieces = explode("-", $date);
  $tstamp=mktime(0,0,0,$pieces[1],$pieces[2],$pieces[0]);
  $Tdate = getdate($tstamp);
  $wday=$Tdate["wday"];
  return $wday;
}
?>

simple mysql while

mysql, php No Comments »
<?
 $query = mysql_query("SELECT name FROM Table");
 while ($item = mysql_fetch_object($query)) {
    echo $item->name;
    echo "<br>";
 }
?>

utf-8

mysql, php No Comments »
<?
  header('Content-Type: text/html; charset=utf-8');
?>

<?
 mysql_select_db("DataBase");
 mysql_query("SET NAMES UTF8");
?>

simple session()

php No Comments »
<?
session_start();

if($_GET['sample']){ $_SESSION['sample'] = $_GET['sample']; }
if(!$_SESSION['sample']){ $_SESSION['sample'] = 'default'; }
?>

header

php No Comments »

http://www.php.net/manual/en/function.header.php

<?
 header('Location: http://www.example.com/');
?>
WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in