RE: [PHP] PHP4 mysqli with mysql 4.1.7?

2004-12-10 Thread Francis Mak
 What happens in your application if you just do:

 mysql_query(SET CHARACTER SET utf8, $connection) or die(mysql_error());

 right after you connect to the database?

Thank you, by adding mysql_query(SET CHARACTER SET utf8, $connection), it
works now.  However, I am still confused on some issue:

1. Is it possible to set the PHP mysql client to use utf8 as default?  In
this way, I do not need to modify all of my applications.
2. Why mysqli + 4.1.x is recommended?


Francis Mak

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] PHP4 mysqli with mysql 4.1.7?

2004-12-10 Thread Richard Lynch
Francis Mak wrote:
 What happens in your application if you just do:

 mysql_query(SET CHARACTER SET utf8, $connection) or
 die(mysql_error());

 right after you connect to the database?

 Thank you, by adding mysql_query(SET CHARACTER SET utf8, $connection),
 it
 works now.  However, I am still confused on some issue:

 1. Is it possible to set the PHP mysql client to use utf8 as default?  In
 this way, I do not need to modify all of my applications.

No idea.

But you could move this query to right after the mysql_connect() line in
your applicationsk, which should really be a very limited number of
places.

 2. Why mysqli + 4.1.x is recommended?

I haven't the foggiest idea on this one.  Hell, I don't even know what
mysqli *IS* for that matter...

I'm getting old and can't keep up with these whippersnapper PHP Developers
any more :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP4 mysqli with mysql 4.1.7?

2004-12-09 Thread Francis Mak
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


Re: [PHP] PHP4 mysqli with mysql 4.1.7?

2004-12-09 Thread Richard Lynch
Francis Mak wrote:
 mysqli_query($c, SET CHARACTER SET utf8;);

The naive user, who understands *NOTHING* about i18l (?) functions,
character sets, or anything other than American English (and not all that
up on the esoterics of grammar in that) asks:

What happens in your application if you just do:

mysql_query(SET CHARACTER SET utf8, $connection) or die(mysql_error());

right after you connect to the database?

In an ideal world, you've told MySQL to use utf8, and that would be that.

Yeah, right.

Worth a try, since it will take you 5 seconds, and *might* just work

You may want to repeat your question on the PHP International list, if
that's still going.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php