PDA

View Full Version : 3 small questions



kirupadupa
May 26th, 2009, 05:27 PM
Hi folks :cap: ,

I have 3 small questions about php scripts.

Nr 1....
I want to show the first x characters of a certain field of a table for example "this blablablablabla" and show only the 10 first characters "this blabl". How to do this?

Nr 2...
How to create a ABCDEFGH... menu. For example, when the person clicks B, you see all records that start with B from a certain column. I would like to create my page like this page.php?character=B , i suppose its kind of same code like question 1?

Nr 3...
I would like to create a "birthday" reminder. For example. I have a friends database and i put the date of birth in the column "date" (2009/05/26) and i would like that the systems warns me next year 5 days before with a text message. Or a counter that says "10 days before birthday"

Any solutions are welcome!

Thx

simplistik
May 26th, 2009, 06:15 PM
http://www.bytemycode.com/snippets/snippet/4/

simple example 1 way to do it, but there are many:


<?php
// your url looks like page.php?character=a or page.php?character=b
$character = $_GET['character'];

switch ($character) {
case 'a':
$content = "a content";
case 'b':
$content = "b content";
case 'c':
$content = "c content";
}

echo $content;
?>

http://us3.php.net/manual/en/control-structures.switch.php

cronjob cronjob