PHP4 mysqli with mysql 4.1.7?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This message is a bit long, but I hope somebody could help me on this issue,
thank you .

I am using mysql 4.1.0(default-character-set=utf8) with PHP 4.3.3.  All
tables are using utf8 charset.
I can insert, select and display the utf8 character without any problem
using PHP, I used the normal mysql_query operation, NOT mysqli.  Yes,
msqyl_query works well in 4.1.0.

Now, I upgraded to 4.1.7(default-character-set=utf8).  I use mysql client
and I can see all data in 4.1.7 are utf8.  However, PHP shows all as ???.
>SHOW VARIABLES LIKE '%charset%'
>character_set_server  utf8
>character_set_system  utf8
>character_set_database  utf8
>character_set_client  utf8
>character_set_connection utf8
>character_set_results  utf8
>collation_connection  utf8_general_ci
>collation_database  utf8_general_ci
>collation_server  utf8_general_ci

I struggled for a few days and finally discovered a message in mysql-lists
by Marek Lewczuk(UTF-8 problem, 24/5/2004), he has the follwing in his PHP
script:

mysqli_query($c, "SET CHARACTER SET utf8;");
mysqli_query($c, "SELECT * FROM db");

I have never used mysqli before, and I found it is only avaliable in PHP5.

I have several questions to ask:

1. Can I compile PHP4 with mysqli extention?  Is there any tricks to do
this?
2. Why mysql 4.1 + mysqli is recommended?  But not the normal mysql
extention?
3. If I upgrade to mysql 4.1.7 + PHP5, I need to rewrite all of my
application to use mysqli instead of mysql?  Any advise on this issue?
4. I see that we must use mysqli_query($c, "SET CHARACTER SET utf8;");
before any query, can I compile the mysqli extention to use utf8 as default?
5. In http://www.php.net/manual/en/ref.mysql.php I see a note: " If you need
charsets other than latin (default), you have to install external (not
bundled) libmysql with compiled charset support. "  So, it means it is
possible to use mysql_query to with utf8?
6. Any reason why I can use mysql_query with 4.1.0 without any problem?

I know there are many questions, but I hope somebody could help me.  And I
believes there are lots of people having the same upgrade issue.
if utf8 + 4.1.7 + mysqli_query is a must instead of 4.1.7 + mysql_query, I
am sure that there will be lots of problem come up as most PHP applications
are using mysql_query only.

THANK YOU VERY MUCH!!!

Francis Mak

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux