Image Sizing in HTML/CSS

Posted by & filed under PHP Development.

If you are working on a small project and no one has the time to go in and resize all images to fit a specified area, I have a quick fix for you. This fix only works when the specified area is restricted by either height or width: img {width: 180px; height: *%; }. This… Read more »

Playing music (mp3s) from ../public_html

Posted by & filed under PHP Development.

Hey everyone. I’m looking for a solution that will allow mp3s to play from a private directory below the public_html directory. For instance, all my mp3s are in the “/home/user/private/” directory while my web-files reside in “/home/user/public_html/”. The problem with this setup is that the client side needs a client path: “www.iaps.ca/private”, but since the… Read more »

PHP-MySQLi bind_params() int or string?

Posted by & filed under PHP Development.

When using the mysqli_bind_params() function, you may want to consider listing int parameters as strings if the number may be greater than the maximum allowed value for an int. For Example: If you specify type “i” (integer), the maximum value it allows you to have is 2^32-1 or 2147483647. So, if you are using UNSIGNED… Read more »

Image Uploads via Form Submission

Posted by & filed under PHP Development.

If any of you developers are having issues uploading files, remember to ensure enctype=”multipart/form-data” is an attribute of your form declaration: … FacebookTwitterPinterestDiggemailPrint

Session-vars with header() transfer

Posted by & filed under PHP Development.

Having issues with $_SESSION[‘var’]’s not being saved after you redirect the user via header()? Add exit(); after the header() call. Example: $_SESSION[’emailed’] = true; header(‘Location: response.php’); exit(); Cheers! FacebookTwitterPinterestDiggemailPrint

PHP number_format()

Posted by & filed under PHP Development.

We’ve tried many different methods to set precision for a number variable (specifically a currency amount) and we’d like to share the best method we’ve found: number_format( {number}, {precision}, ‘decimal_separator’, ‘1000s_separator’ ); Example: number_format( $number, 2, ‘.’, ‘,’ ); Hope this helps! We have also tried using round( $number, {precision} ) but it ignores zeros(0)… Read more »