27
2010
String dd-mm-yyyy convert to date yyyy-mm-dd
<?php $date = "25-12-2010";//[something in US format: mm-dd-yy] $newdate = substr($date,6,4) . "-" . substr($date,3,2) . "-" . substr($date,0,2); print "\n=====\n".$newdate."\n===============\n"; ?>
24
2010
Search and replace within a field with regex in MySQL
SELECT * FROM ‘table’ WHERE `name` REGEXP ‘\r’ UPDATE ‘table’ SET ‘field’ = REPLACE(FIELD,"findvalue", "reaplcevalue") WHERE REGEXP ‘regexp search expression’
22
2010
UTF-8 connect to MySQL database
mysql_query("SET NAMES ‘utf8′ COLLATE ‘utf8_slovenian_ci’"); mysql_query("SET CHARACTER SET ‘utf8′;");
22
2010
How to change the collation for all tables in a MySQL database to UTF-8?
<?php $db = mysql_connect("localhost", "username", "pass"); if(!$db) echo "Cannot connect to the database – incorrect details"; mysql_select_db(‘myuser_mydbname’); $result=mysql_query(‘show tables’); while($tables = mysql_fetch_array($result)) { foreach ($tables as $key => $value) { mysql_query("ALTER TABLE $value COLLATE utf8_slovenian_ci"); }} echo "The collation of your database has been successfully changed!"; ?>
18
2010
PHP Calculating script execution time
<?php $start = (float) array_sum(explode(‘ ‘,microtime())); // put you code that wanted to render at here $end = (float) array_sum(explode(‘ ‘,microtime())); echo "Processing time: ". sprintf("%.4f", ($end-$start))." seconds"; ?>
Kategorije
- Ostalo (161)
- Računalništvo (266)
- Centos (34)
- CSS (2)
- FreeBSD (37)
- jQuery (1)
- MySQL (8)
- Na spletu dogaja … (124)
- Netbeans (4)
- PHP (20)
- Symbian (3)
- Ubuntu (32)
- Windows (5)
- Zend Framework (6)
- Zend Studio (1)
Blogroll
Arhiv
- February 2011 (5)
- December 2010 (4)
- November 2010 (2)
- October 2010 (5)
- September 2010 (6)
- August 2010 (5)
- July 2010 (10)
- June 2010 (9)
- May 2010 (10)
- April 2010 (8)
- March 2010 (12)
- February 2010 (19)
- January 2010 (20)
- December 2009 (10)
- November 2009 (1)
- October 2009 (3)
- September 2009 (2)
- August 2009 (9)
- June 2009 (11)
- May 2009 (5)
- April 2009 (6)
- March 2009 (9)
- February 2009 (15)
- January 2009 (10)
- December 2008 (17)
- November 2008 (20)
- October 2008 (16)
- September 2008 (48)
- August 2008 (56)
- July 2008 (35)
- June 2008 (35)
An article by