Search found 198 matches
- Fri Sep 21, 2012 7:23 pm
- Forum: PHP
- Topic: PHP Warning: preg_match(): Compilation failed: missing ) at
- Replies: 5
- Views: 31974
Re: PHP Warning: preg_match(): Compilation failed: missing
There is probably a character in $c_line[1] that breaks your regular expression ($pattern). You can use preg_quote() to escape special characters. Your code should look something like this: $pattern="/\b".preg_quote($c_line[1])."\b/i"; if(preg_match($pattern,$text)) $countries[]=...
- Tue Sep 18, 2012 12:40 pm
- Forum: PHP
- Topic: PHP Warning: preg_match(): Compilation failed: missing ) at
- Replies: 5
- Views: 31974
Re: PHP Warning: preg_match(): Compilation failed: missing
Sound like a problem in your regex.
If you post some of you code, we could check it out.
If you post some of you code, we could check it out.
- Tue Sep 18, 2012 12:38 pm
- Forum: PHP
- Topic: Sort multi-array
- Replies: 1
- Views: 20828
Re: Sort multi-array
I usually create my own function and use it with usort: function num_sort($a,$b) { return strcmp($a[2],$b[2]); } And call it with usort($multi_array,"num_sort"); The array is in this case the second field named '2' (But you can give it any name you want). $multi_array['key1'][1]="valu...
- Tue Sep 18, 2012 12:08 pm
- Forum: PHP
- Topic: How do I search in multi-array
- Replies: 1
- Views: 20795
Re: Ho do I search in multi-array
You can create your own function:
You can call the function with
Code: Select all
function search_multi_arr($needle,$haystack)
{
foreach ($haystack as $key => $val)
{
if ($val[1] === $needle) return $key;
}
return null;
}
Code: Select all
$key=search_multi_arr($search_value,$multi_array);
- Thu Sep 13, 2012 3:19 pm
- Forum: MySQL
- Topic: Solved: convert MySQL db from Latin1 to UTF8
- Replies: 7
- Views: 134183
Re: convert MySQL db from Latin1 to UTF8
If you still have problems.
you can also use, in php:
It tells php to do everything in UTF-8 character-set.
you can also use, in php:
Code: Select all
mb_internal_encoding("UTF-8");
- Thu Sep 13, 2012 2:17 pm
- Forum: MySQL
- Topic: Solved: convert MySQL db from Latin1 to UTF8
- Replies: 7
- Views: 134183
Re: convert MySQL db from Latin1 to UTF8
You can test if your server and browser are "speaking" in UTF-8 with printing the following string. $test='Iñtërnâtiônàlizætiøn'; echo $test."\n"; If you don't see the string correctly, try adding the HTML line: <meta http-equiv="Content-Type" content="text/html; c...
- Thu Sep 06, 2012 3:22 pm
- Forum: MySQL
- Topic: Solved: convert MySQL db from Latin1 to UTF8
- Replies: 7
- Views: 134183
Re: convert MySQL db from Latin1 to UTF8
Are your text string wrong in the database, or do you see the results in you browser. Because the problem with character set is that all programs need to know what character set is used. Not only the database server (MySQL), but also the application server (php/apache, ASP/IIS, ...) and your browser...
- Wed Sep 05, 2012 3:49 pm
- Forum: SQL
- Topic: How do I find the size of my database?
- Replies: 1
- Views: 18374
Re: How do I find the size of my database?
With MySQL you can give the following command: SELECT table_schema "database_name",sum( data_length + index_length ) / 1024 /1024 "Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema; This tells the size in MB. But you can install phpMyAdmin ( http://www.ph...
- Sun Sep 02, 2012 12:02 pm
- Forum: Servers
- Topic: convert MySQL db from Latin1 to UTF8
- Replies: 1
- Views: 30190
Re: convert MySQL db from Latin1 to UTF8
You probably set default-character-set=utf8 Under [client] in /etc/mysql/my.cnf You also need to set it under [mysqld] ; Actually character-set-server=utf8 would be better. This should take care of the Server characterset . For your database you have to do some additional steps. in MySQL give the fo...
- Sun Sep 02, 2012 12:02 pm
- Forum: MySQL
- Topic: Solved: convert MySQL db from Latin1 to UTF8
- Replies: 7
- Views: 134183
Re: convert MySQL db from Latin1 to UTF8
You probably set default-character-set=utf8 Under [client] in /etc/mysql/my.cnf You also need to set it under [mysqld] ; Actually character-set-server=utf8 would be better. This should take care of the Server characterset . For your database you have to do some additional steps. in MySQL give the fo...