Even experience php programmer can make mistake, since most of them are typo php error message then become valuable resource for debugging.
By default, error message will show depend on error made, but in specific environment where tweaking in php.ini has been made by system administrator. Such free hosting will do it for good.
With assumption that php_ini not included in list of “disable_function” then php_ini will help 🙂
$first_name = trim($_GET[‘first_name’]);
If there is no parse errror, the above enables “Notice: Undefined” error on screen.
If the code for an error the “Parse error” as follows, the error isn’t defined as should be
) will be error source, running it then you’ll get this error message
Parse error: parse error, unexpected ‘)’, expecting ‘,’ or ‘;’ in a.php on line 7
now, what you get for this ?
eho $first_name; // should be echo
parse error or …..
Simple way to insert time information in mysql is using now()
now() will automatically insert appropriate depends on type, let say we have field in mysql database in these format :
1. birth (date), now() will insert current date, ex: 2007-05-02
2. birth (datetime), now() will insert current date + current time, ex : 2007-05-2 22:54:30
3. birth (time), now() will insert only time information, ex : 22:54:30
this snippet will get same result with now()
$birth=date(‘Y’).’-‘.date(‘m’).’-‘.date(‘d’); // will be same as 2007-05-02
example in mysql command line :
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>cd c:\appserv\mysql\bin
C:\AppServ\mysql\bin>mysql -uroot -p
Welcome to the MySQL monitor.ï¿½ Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.24-nt
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql> create database test;
Query OK, 1 row affected (0.03 sec)
mysql> use test;
Progress in *BSD world is very fast, everyday patch released, program update etc
to get that update via internet FreeBSD provide a few tools :
- cvs, not so familiar for beginner
- cvsup, very famous in FreeBSD, can update ports, source even for backup purpose
- portsnap, only for port update, in FreeBSD tree since 6.0
- csup, cvsup alternative, already integrated in 6.2 tree, no need to install, compatible with cvsup
example for cvs :
cvs -z3 -d :pserver:[email protected]:/cvs co -P freesbie2
will fetch freesbie2 and located in current directory where command issued
example for cvsup :
cvsup -g -L2 ports-supfile -h cvsup12.freebsd.org
will update ports information
example for portsnap :
will update ports data, faster than portsnap extract
csup example :
cvsup -g -L2 stable-supfile -h cvsup12.freebsd.org
will update stable source
make sure port 5999/tcp open for cvsup and csup
portsnap will use port 80
Many linux distro build nowadays, each distro came with spesific purpose, server, workstation or desktop orientation but still not forget to give access to shell
people who run “ifconfig” in mandriva will get confuse when run same command in fedora or maybe slackware
“command not found” is common message
just use “whereis” command for this purpose :
answer will show up for full path of program
type full path in shell to get same result, not easy but always work
As big fan of FreeBSD ports, I like to play around with ports option, like when installing php4 I was prompted with a lot of build options :
kongja# whereis php4
kongja# cd /usr/ports/lang/php4
then this ncurse option will popup
===> Found saved configuration for php4-4.4.6
===> Extracting for php4-4.4.6