Sunday, February 22, 2009

You can use getimagesize() function to get width and height of a swf /flash file.getimagesize() is also used to get size of images.To find out supported formats and return values go to this linkhttp://www.php.net/getimagesize

Following code is a simple example on how to get the width and height of a swf file.

Sunday, February 15, 2009

When using the php date function you can format the date in lot of ways.But when you store date and time in mysql it is really convenient to store date in the mysql friendly format YYYY-MM-DD HH:MM:SSIf you use the above format you can easily use mysql date functions to manipulate and do calculation on stored dates without using php functions.

Tuesday, February 10, 2009

Yes you can definitely create foreign key constraints on mysql. but it can only be enforced in InnoDB storage engine. The default storage engine is MyISAM, you cannot create foreign key constraints in MyISAM. So make sure you create your tables using InnoDB storage engine.If you are using a phpMyAdmin to work with mysql, look at the following ScreenShot.

Remember, before making a column available for referencing you should make sure that child column has a Index.

Now using Relation view link you can easily create foreign key constraints

Sunday, February 1, 2009

The easiest way to add a HTML break to all new lines in a string is to use the php nl2br() function. This is really great when you want to restore new lines from a user input by a textarea where user input could get into several lines.