Tag Archives: PHP

PHP: How to Check if mysql_query() has returned a Result Set

mysql_query() is the powerful PHP function tasked with handling the execution of all SQL statements against the currently active database connection string. It handles all variations of SQL commands, including SELECT, INSERT, UPDATE, DELETE, etc, and always returns false if the command execution should fail. However, only on SELECT does it bother returning a valid result set – the rest of the time it returns true.
Continue reading

Posted in PHP | Tagged boolean, is_bool, mysql_query, , result set | View Comments

Ubuntu: How to set PHP’s default Time Zone

From PHP 5.1 onwards, you have been able to define the default time zone which is to be used in PHP regardless of what time zone the server or Apache might be using. To do this requires some minor adjustments to your php.ini config file. Continue reading

Posted in PHP | Tagged , , , , | View Comments

How to Reuse a MySQL Result Set

To reuse an existing result set returned from a query is actually pretty simple thanks to PHP’s mysql_data_seek function and the fact that mysql_query returns a buffered result set by default.
Continue reading

Posted in MySQL, PHP | Tagged data seek, , mysql_data_seek, , result set, resultset, reuse | View Comments

PHP: Loop through each string line in a Textarea

To loop through all the string inputs entered on a new line for a textarea control is not particularly challenging and uses basic array functionality to achieve this.
Continue reading

Posted in PHP | Tagged , , string line, textarea | View Comments

PHP: Return all String Permutations for a 1 Dimensional Array

Getting all the possible string permutations of an array can be pretty useful if you are trying to unlock something and this nifty little function does exactly that: Continue reading

Posted in PHP | Tagged , permutation, , string permutation | View Comments
Navigation »