Ubuntu phpmyadmin connect to mysql error: #2002 cannot log in to the mysql server
August 22, 2014
If phpmyadmin cannot connect to mysql error: #2002 cannot log in to the mysql server Run: sudo nano /etc/mysql/my.cnf Update bind-address = 192.168.0.2 To bind-address = localhost This fixed the problem. Enjoy. ref: here
Ubuntu 10.04.4 upgrade php 5.3.2 to 5.3.6
August 22, 2014
For anyone who wants to upgrade Ubuntu 10.04 LTS to PHP 5.3.10, this is how I have done it. Note sudo apt-add-repository ppa:brianmercer/php5 doesn’t work anymore. Suspect has been taken down. sudo apt-add-repository ppa:brianmercer/php5 will not work anymore However the steps below do work!! sudo add-apt-repository ppa:bjori/php5 sudo apt-get update sudo aptitude show php5 Package: […]
PHP get first key in associative array
August 7, 2014
If efficiency is not that important can use array_keys($yourArray)[0] in PHP 5.4 (and higher). Output: a
jQuery handle null value in PHP variable or array
August 6, 2014
Handling php array or variable inside javascript directly using json_encode, will result some value null. To check null using jquery in this case:
jQuery select list set selected using php variable
August 6, 2014
Using jQuery to set the selected element of the select control to be the item with the text description. Value from php.
jQuery Datepicker does not work in dynamic element
August 5, 2014
This always happen when bind the event initially, the new field doesn’t exist. A better way is initialize the datepicker for the field when create the element. Example after an AJAX call to build the fields:
PHP check a string is an email address format
July 29, 2014
With PHP v5.2.0 or greater, you may use regular expressions.
PHP replace spaces in urls image name
July 21, 2014
Looking to replace all instances of spaces in urls with %20? No need for a regex. Use rawurlencode() instead urlencode() for this purpose. Example: urlencode($img) will result It will not change to %20. But with rawurlencode($img), it produce Another way of doing it is using str_replace
PHP sort multidimensional Array by specific key value
July 14, 2014
Try usort for multidimensional array sorting by specific key value inside each sub array. Example: The best way is: reference: http://stackoverflow.com/questions/2699086/sort-multidimensional-array-by-value-2
FUELPHP Form Checkbox checked
July 1, 2014
FuelPHP checkbox is not a nightmare if understand it’s parameters correctly. The syntax is checkbox($field, $value = null, $checked = null, $attributes = array()) To built form checkbox, simply do like below: Will output a checked checkbox: To uncheck the checkbox, changed the ‘checked’ value to empty ” or null
Recent Comments