Currently Browsing

Programming

Ever wondered what the difference between mysql_fetch_array and mysql_fetch_assoc is? What about mysql_fetch_row? I’ve always used mysql_fetch_array, but, for debugging purposes, here’s what they all do: mysql_fetch_assoc returns an associative array of your field names eg $row['field_name_here'] mysql_fetch_row returns a numeric array eg $row[0] returns the first column, $row[1] returns the second column etc. – not a good idea as it makes...

The latest version of the WordPress eCards plugin brings some HTML5 form improvements. For example, the input fields are now properly validated using their input types: <input type=”text” name=”ecard_from” size=”30″ required autofocus /> This field is required, and receives automatic focus on page load. The email fields now require valid email addresses based on the type=”email” attribute: <input type=”email” name=”ecard_email_from”...

Integers Integers are a subset of the real numbers. They are written without a fraction or a decimal component. Integers fall within a set Z = {…, -2, -1, 0, 1, 2, …} Integers are infinite. Computers can practically work only with a subset of integer values, because computers have finite capacity. Integers are used to count discrete entities. We...

PHP has a feature that allows you to pre-pend a file at every PHP request. This prepend file is the equivalent of having it include()ed at the top of every single PHP script on your site. It’s is done through a directive that is set either in php.ini or .htaccess. The directive is called auto_prepend_file. It’s also evil if you...

I’ve always sucked at date/time calculations using PHP or MySQL. This changed a while ago when I broke the ice with a Facebook-style function for calculating time diferrence in a friendly way. Today, I had to calculate past dates using 2 separate date and time columns. MySQL uses NOW() to output a date format such as "2011-03-10 14:30:00". My date...

behance roo wordpress
Cog Cog