Search found 197 matches

by chris
Tue Sep 18, 2012 12:40 pm
Forum: PHP
Topic: PHP Warning: preg_match(): Compilation failed: missing ) at
Replies: 5
Views: 31270

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.
by chris
Tue Sep 18, 2012 12:38 pm
Forum: PHP
Topic: Sort multi-array
Replies: 1
Views: 20158

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...
by chris
Tue Sep 18, 2012 12:08 pm
Forum: PHP
Topic: How do I search in multi-array
Replies: 1
Views: 20150

Re: Ho do I search in multi-array

You can create your own function:

Code: Select all

function search_multi_arr($needle,$haystack)
{
  foreach ($haystack as $key => $val)
  {
    if ($val[1] === $needle) return $key;
  }
  return null;
}
You can call the function with

Code: Select all

$key=search_multi_arr($search_value,$multi_array);
by chris
Thu Sep 13, 2012 3:19 pm
Forum: MySQL
Topic: Solved: convert MySQL db from Latin1 to UTF8
Replies: 7
Views: 133467

Re: convert MySQL db from Latin1 to UTF8

If you still have problems.
you can also use, in php:

Code: Select all

mb_internal_encoding("UTF-8");
It tells php to do everything in UTF-8 character-set.
by chris
Thu Sep 13, 2012 2:17 pm
Forum: MySQL
Topic: Solved: convert MySQL db from Latin1 to UTF8
Replies: 7
Views: 133467

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...
by chris
Thu Sep 06, 2012 3:22 pm
Forum: MySQL
Topic: Solved: convert MySQL db from Latin1 to UTF8
Replies: 7
Views: 133467

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...
by chris
Wed Sep 05, 2012 3:49 pm
Forum: SQL
Topic: How do I find the size of my database?
Replies: 1
Views: 18256

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...
by chris
Sun Sep 02, 2012 12:02 pm
Forum: Servers
Topic: convert MySQL db from Latin1 to UTF8
Replies: 1
Views: 29542

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...
by chris
Sun Sep 02, 2012 12:02 pm
Forum: MySQL
Topic: Solved: convert MySQL db from Latin1 to UTF8
Replies: 7
Views: 133467

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...
by chris
Thu Aug 30, 2012 3:30 pm
Forum: SQL
Topic: Set bit to TRUE/FALSE
Replies: 1
Views: 17736

Re: Set bit to TRUE/FALSE

You can use TININT(1) to set a value of 1 bit (0 or 1).

But my personal favorite is EMNUM

Code: Select all

valuename enum('true','false') NOT NULL default 'false'
note: ENUM can have more then 2 values, up to 65,535.