Category Archives: PHP Development
Inherit jQuery Functionality for Dynamic Additions
Our latest project requires a lot of event driven functionality which attempts to reuse click() functions. Unfortunately when you dynamically add an element to the DOM it does not automatically inherit any functions that were loaded in $(document).ready(). For example: if you have a text-box and an “add” button (A) which, when clicked, adds a [...]
Image Sizing in HTML/CSS
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 [...]
Playing music (mp3s) from ../public_html
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 [...]
PHP-MySQLi bind_params() int or string?
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 [...]
Image Uploads via Form Submission
If any of you developers are having issues uploading files, remember to ensure enctype=”multipart/form-data” is an attribute of your form declaration: …
Session-vars with header() transfer
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!
number_format()
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) [...]