RE: [PHP-DB] Possible MySQLi extension BUG!

2005-09-13 Thread Ziv Gabel
this is probably the reason that everything I do that got somthing to do with 
programming is always in english
I don't understand why you need all this problems when you can make all your 
background work (mysql db names,fields,variables) in english and spare the 
trouble of having to debug encoding problems
 
best regards 
ziv gabel



מאת: Bastien Koert [mailto:[EMAIL PROTECTED]
נשלח: ו 09/09/2005 20:05
אל: [EMAIL PROTECTED]; php-db@lists.php.net
נושא: RE: [PHP-DB] Possible MySQLi extension BUG!



Questions:

1. what is the current database collation and character set? check with
whatever GUI tool you use to admin the db

2. Are they the same? ie UTF-8

3. the query of course would be correct since it hasn't touched mysql yet.
Its a straight representation from PHP.

Notes:
1. Spaces in DB table/field names are a really bad idea and should be
avoided if possible. Replace the spaces with underscores if you want the
appearance of the space


Bastien


From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 12:50:31 -0500

Ok,

Firs of all, I wanna say I have spent a whole week looking for answers
elsewhere. The reason of this message is to look for a practical solution.

My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign characters.
The language is spanish, so you use accends or tilde on some works
(example, comisi?n, ni?o, etc).

I have a simple query that uses tables (named with this foreign
characters). Example:

directorio
   - Empresa
   - Direcci?n
   - Asistente de Direcci?n

A query to this database should be as follows:

SELECT *
FROM `Asistente de Direcci?n`;

This returns an error like:

Table 'directorio.Asistente de Direcci?³n' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
 mbstring.internal_encodign = UTF-8
 mbstring.http_input = UTF-8
 mbstring.http_output = UTF-8
 mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
old_passwords=1
default-character-set=utf8
[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysql]
default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except
default-character-result its set to NULL

As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall',
'directorio');

if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
 FROM `Empresa`,
 `Presidente`,
 `Asistente de Presidencia`,
 `Director`,
 `Asistente de Direcci?n`, `
 Centro de Distribuci?n 01`,
 `Centro de Distribuci?n 02`,
 `Centro de Distribuci?n 03`,
 `Centro de Distribuci?n 04`,
 `Centro de Distribuci?n 05`,
 `Centro de Distribuci?n 06`,
 `Centro de Distribuci?n 07`,
 `Centro de Distribuci?n 08`,
 `Centro de Distribuci?n 09`,
 `Centro de Distribuci?n 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Direcci?n`.ID
AND Empresa.ID = `Centro de Distribuci?n 01`.ID
AND Empresa.ID = `Centro de Distribuci?n 02`.ID
AND Empresa.ID = `Centro de Distribuci?n 03`.ID
AND Empresa.ID = `Centro de Distribuci?n 04`.ID
AND Empresa.ID = `Centro de Distribuci?n 05`.ID
AND Empresa.ID = `Centro de Distribuci?n 06`.ID
AND Empresa.ID = `Centro de Distribuci?n 07`.ID
AND Empresa.ID = `Centro de Distribuci?n 08`.ID
AND Empresa.ID = `Centro de Distribuci?n 09`.ID
AND Empresa.ID = `Centro de Distribuci?n 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
   // Print the data obtained
   print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as long as
you have your webpage with the charset meta-tag set to utf-8 and
everything utf-8 encoded... you'll get the right

[PHP-DB] Possible MySQLi extension BUG!

2005-09-09 Thread Renich Bon Ciric

Ok,

Firs of all, I wanna say I have spent a whole week looking for answers 
elsewhere. The reason of this message is to look for a practical solution.


My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign 
characters. The language is spanish, so you use accends or tilde on some 
works (example, comisión, niño, etc).


I have a simple query that uses tables (named with this foreign 
characters). Example:


directorio
- Empresa
- Dirección
- Asistente de Dirección

A query to this database should be as follows:

SELECT *
FROM `Asistente de Dirección`;

This returns an error like:

Table 'directorio.Asistente de Dirección' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
  mbstring.internal_encodign = UTF-8
  mbstring.http_input = UTF-8
  mbstring.http_output = UTF-8
  mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 old_passwords=1
 default-character-set=utf8
 [mysql.server]
 user=mysql
 basedir=/var/lib

 [mysqld_safe]
 err-log=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

 [mysql]
 default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except 
default-character-result its set to NULL


As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall', 'directorio');

if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
  FROM `Empresa`,
  `Presidente`,
  `Asistente de Presidencia`,
  `Director`,
  `Asistente de Dirección`, `
  Centro de Distribución 01`,
  `Centro de Distribución 02`,
  `Centro de Distribución 03`,
  `Centro de Distribución 04`,
  `Centro de Distribución 05`,
  `Centro de Distribución 06`,
  `Centro de Distribución 07`,
  `Centro de Distribución 08`,
  `Centro de Distribución 09`,
  `Centro de Distribución 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Dirección`.ID
AND Empresa.ID = `Centro de Distribución 01`.ID
AND Empresa.ID = `Centro de Distribución 02`.ID
AND Empresa.ID = `Centro de Distribución 03`.ID
AND Empresa.ID = `Centro de Distribución 04`.ID
AND Empresa.ID = `Centro de Distribución 05`.ID
AND Empresa.ID = `Centro de Distribución 06`.ID
AND Empresa.ID = `Centro de Distribución 07`.ID
AND Empresa.ID = `Centro de Distribución 08`.ID
AND Empresa.ID = `Centro de Distribución 09`.ID
AND Empresa.ID = `Centro de Distribución 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
// Print the data obtained
print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as long 
as you have your webpage with the charset meta-tag set to utf-8 and 
everything utf-8 encoded... you'll get the right query...


this is

SELECT * FROM `Empresa`, `Presidente`, `Asistente de Presidencia`, 
`Director`, `Asistente de Dirección`, ` Centro de Distribución 01`, 
`Centro de Distribución 02`, `Centro de Distribución 03`, `Centro de 
Distribución 04`, `Centro de Distribución 05`, `Centro de Distribución 
06`, `Centro de Distribución 07`, `Centro de Distribución 08`, `Centro 
de Distribución 09`, `Centro de Distribución 10` WHERE Empresa.Emp_Gro 
LIKE '%try this%' AND Empresa.ID = Presidente.ID AND Empresa.ID = 
`Asistente de Presidencia`.ID AND Empresa.ID = Director.ID AND 
Empresa.ID = `Asistente de Dirección`.ID AND Empresa.ID = `Centro de 
Distribución 01`.ID AND Empresa.ID = `Centro de Distribución 02`.ID AND 
Empresa.ID = `Centro de Distribución 03`.ID AND Empresa.ID = `Centro de 
Distribución 04`.ID AND Empresa.ID = `Centro de Distribución 05`.ID AND 
Empresa.ID = `Centro de Distribución 06`.ID AND Empresa.ID = `Centro de 
Distribución 07`.ID AND Empresa.ID = `Centro de Distribución 08`.ID AND 
Empresa.ID = `Centro de Distribución 09`.ID AND Empresa.ID = `Centro de 
Distribución 

RE: [PHP-DB] Possible MySQLi extension BUG!

2005-09-09 Thread Bastien Koert

Questions:

1. what is the current database collation and character set? check with 
whatever GUI tool you use to admin the db


2. Are they the same? ie UTF-8

3. the query of course would be correct since it hasn't touched mysql yet. 
Its a straight representation from PHP.


Notes:
1. Spaces in DB table/field names are a really bad idea and should be 
avoided if possible. Replace the spaces with underscores if you want the 
appearance of the space



Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 12:50:31 -0500

Ok,

Firs of all, I wanna say I have spent a whole week looking for answers 
elsewhere. The reason of this message is to look for a practical solution.


My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign characters. 
The language is spanish, so you use accends or tilde on some works 
(example, comisión, niño, etc).


I have a simple query that uses tables (named with this foreign 
characters). Example:


directorio
- Empresa
- Dirección
- Asistente de Dirección

A query to this database should be as follows:

SELECT *
FROM `Asistente de Dirección`;

This returns an error like:

Table 'directorio.Asistente de Dirección' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
  mbstring.internal_encodign = UTF-8
  mbstring.http_input = UTF-8
  mbstring.http_output = UTF-8
  mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 old_passwords=1
 default-character-set=utf8
 [mysql.server]
 user=mysql
 basedir=/var/lib

 [mysqld_safe]
 err-log=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

 [mysql]
 default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except 
default-character-result its set to NULL


As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall', 
'directorio');


if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
  FROM `Empresa`,
  `Presidente`,
  `Asistente de Presidencia`,
  `Director`,
  `Asistente de Dirección`, `
  Centro de Distribución 01`,
  `Centro de Distribución 02`,
  `Centro de Distribución 03`,
  `Centro de Distribución 04`,
  `Centro de Distribución 05`,
  `Centro de Distribución 06`,
  `Centro de Distribución 07`,
  `Centro de Distribución 08`,
  `Centro de Distribución 09`,
  `Centro de Distribución 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Dirección`.ID
AND Empresa.ID = `Centro de Distribución 01`.ID
AND Empresa.ID = `Centro de Distribución 02`.ID
AND Empresa.ID = `Centro de Distribución 03`.ID
AND Empresa.ID = `Centro de Distribución 04`.ID
AND Empresa.ID = `Centro de Distribución 05`.ID
AND Empresa.ID = `Centro de Distribución 06`.ID
AND Empresa.ID = `Centro de Distribución 07`.ID
AND Empresa.ID = `Centro de Distribución 08`.ID
AND Empresa.ID = `Centro de Distribución 09`.ID
AND Empresa.ID = `Centro de Distribución 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
// Print the data obtained
print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as long as 
you have your webpage with the charset meta-tag set to utf-8 and 
everything utf-8 encoded... you'll get the right query...


this is

SELECT * FROM `Empresa`, `Presidente`, `Asistente de Presidencia`, 
`Director`, `Asistente de Dirección`, ` Centro de Distribución 01`, `Centro 
de Distribución 02`, `Centro de Distribución 03`, `Centro de Distribución 
04`, `Centro de Distribución 05`, `Centro de Distribución 06`, `Centro de 
Distribución 07`, `Centro de Distribución 08`, `Centro de Distribución 09`, 
`Centro de Distribución 10` WHERE Empresa.Emp_Gro LIKE '%try this%' AND 
Empresa.ID

Re: [PHP-DB] Possible MySQLi extension BUG!

2005-09-09 Thread Renich Bon Ciric

1.- Yes, Everything is UTF-8 with utf8-general-ci as collation
2.- Yes, as I said before
3.- I need to ashure that the query gets there as it is...


Bastien Koert wrote:

Questions:

1. what is the current database collation and character set? check with 
whatever GUI tool you use to admin the db


2. Are they the same? ie UTF-8

3. the query of course would be correct since it hasn't touched mysql 
yet. Its a straight representation from PHP.


Notes:
1. Spaces in DB table/field names are a really bad idea and should be 
avoided if possible. Replace the spaces with underscores if you want the 
appearance of the space



Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 12:50:31 -0500

Ok,

Firs of all, I wanna say I have spent a whole week looking for answers 
elsewhere. The reason of this message is to look for a practical 
solution.


My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign 
characters. The language is spanish, so you use accends or tilde on 
some works (example, comisión, niño, etc).


I have a simple query that uses tables (named with this foreign 
characters). Example:


directorio
- Empresa
- Dirección
- Asistente de Dirección

A query to this database should be as follows:

SELECT *
FROM `Asistente de Dirección`;

This returns an error like:

Table 'directorio.Asistente de Dirección' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
  mbstring.internal_encodign = UTF-8
  mbstring.http_input = UTF-8
  mbstring.http_output = UTF-8
  mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 old_passwords=1
 default-character-set=utf8
 [mysql.server]
 user=mysql
 basedir=/var/lib

 [mysqld_safe]
 err-log=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

 [mysql]
 default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except 
default-character-result its set to NULL


As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall', 
'directorio');


if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
  FROM `Empresa`,
  `Presidente`,
  `Asistente de Presidencia`,
  `Director`,
  `Asistente de Dirección`, `
  Centro de Distribución 01`,
  `Centro de Distribución 02`,
  `Centro de Distribución 03`,
  `Centro de Distribución 04`,
  `Centro de Distribución 05`,
  `Centro de Distribución 06`,
  `Centro de Distribución 07`,
  `Centro de Distribución 08`,
  `Centro de Distribución 09`,
  `Centro de Distribución 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Dirección`.ID
AND Empresa.ID = `Centro de Distribución 01`.ID
AND Empresa.ID = `Centro de Distribución 02`.ID
AND Empresa.ID = `Centro de Distribución 03`.ID
AND Empresa.ID = `Centro de Distribución 04`.ID
AND Empresa.ID = `Centro de Distribución 05`.ID
AND Empresa.ID = `Centro de Distribución 06`.ID
AND Empresa.ID = `Centro de Distribución 07`.ID
AND Empresa.ID = `Centro de Distribución 08`.ID
AND Empresa.ID = `Centro de Distribución 09`.ID
AND Empresa.ID = `Centro de Distribución 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
// Print the data obtained
print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as 
long as you have your webpage with the charset meta-tag set to utf-8 
and everything utf-8 encoded... you'll get the right query...


this is

SELECT * FROM `Empresa`, `Presidente`, `Asistente de Presidencia`, 
`Director`, `Asistente de Dirección`, ` Centro de Distribución 01`, 
`Centro de Distribución 02`, `Centro de Distribución 03`, `Centro de 
Distribución 04`, `Centro de Distribución 05`, `Centro de Distribución 
06`, `Centro de Distribución 07`, `Centro de Distribución 08`, `Centro 
de Distribución 09`, `Centro de Distribución 10` WHERE Empresa.Emp_Gro 
LIKE '%try this%' AND Empresa.ID = Presidente.ID AND Empresa.ID

Re: [PHP-DB] Possible MySQLi extension BUG!

2005-09-09 Thread Bastien Koert
can you cut'n'paste the query into the GUI tool for the db and test the 
query there?


Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net,Bastien Koert [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 13:11:32 -0500

1.- Yes, Everything is UTF-8 with utf8-general-ci as collation
2.- Yes, as I said before
3.- I need to ashure that the query gets there as it is...


Bastien Koert wrote:

Questions:

1. what is the current database collation and character set? check with 
whatever GUI tool you use to admin the db


2. Are they the same? ie UTF-8

3. the query of course would be correct since it hasn't touched mysql yet. 
Its a straight representation from PHP.


Notes:
1. Spaces in DB table/field names are a really bad idea and should be 
avoided if possible. Replace the spaces with underscores if you want the 
appearance of the space



Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 12:50:31 -0500

Ok,

Firs of all, I wanna say I have spent a whole week looking for answers 
elsewhere. The reason of this message is to look for a practical 
solution.


My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign 
characters. The language is spanish, so you use accends or tilde on some 
works (example, comisión, niño, etc).


I have a simple query that uses tables (named with this foreign 
characters). Example:


directorio
- Empresa
- Dirección
- Asistente de Dirección

A query to this database should be as follows:

SELECT *
FROM `Asistente de Dirección`;

This returns an error like:

Table 'directorio.Asistente de Dirección' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
  mbstring.internal_encodign = UTF-8
  mbstring.http_input = UTF-8
  mbstring.http_output = UTF-8
  mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 old_passwords=1
 default-character-set=utf8
 [mysql.server]
 user=mysql
 basedir=/var/lib

 [mysqld_safe]
 err-log=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

 [mysql]
 default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except 
default-character-result its set to NULL


As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall', 
'directorio');


if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
  FROM `Empresa`,
  `Presidente`,
  `Asistente de Presidencia`,
  `Director`,
  `Asistente de Dirección`, `
  Centro de Distribución 01`,
  `Centro de Distribución 02`,
  `Centro de Distribución 03`,
  `Centro de Distribución 04`,
  `Centro de Distribución 05`,
  `Centro de Distribución 06`,
  `Centro de Distribución 07`,
  `Centro de Distribución 08`,
  `Centro de Distribución 09`,
  `Centro de Distribución 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Dirección`.ID
AND Empresa.ID = `Centro de Distribución 01`.ID
AND Empresa.ID = `Centro de Distribución 02`.ID
AND Empresa.ID = `Centro de Distribución 03`.ID
AND Empresa.ID = `Centro de Distribución 04`.ID
AND Empresa.ID = `Centro de Distribución 05`.ID
AND Empresa.ID = `Centro de Distribución 06`.ID
AND Empresa.ID = `Centro de Distribución 07`.ID
AND Empresa.ID = `Centro de Distribución 08`.ID
AND Empresa.ID = `Centro de Distribución 09`.ID
AND Empresa.ID = `Centro de Distribución 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
// Print the data obtained
print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as long 
as you have your webpage with the charset meta-tag set to utf-8 and 
everything utf-8 encoded... you'll get the right query...


this is

SELECT * FROM `Empresa`, `Presidente`, `Asistente de Presidencia`, 
`Director`, `Asistente de Dirección`, ` Centro de Distribución 01`, 
`Centro de Distribución 02`, `Centro de

Re: [PHP-DB] Possible MySQLi extension BUG!

2005-09-09 Thread Renich Bon Ciric
Yep, it does, in fact, if you enter the query to the mysql prompt, it 
works fine.




Bastien Koert wrote:
can you cut'n'paste the query into the GUI tool for the db and test the 
query there?


Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net,Bastien Koert [EMAIL PROTECTED]
CC: php-db@lists.php.net
Subject: Re: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 13:11:32 -0500

1.- Yes, Everything is UTF-8 with utf8-general-ci as collation
2.- Yes, as I said before
3.- I need to ashure that the query gets there as it is...


Bastien Koert wrote:


Questions:

1. what is the current database collation and character set? check 
with whatever GUI tool you use to admin the db


2. Are they the same? ie UTF-8

3. the query of course would be correct since it hasn't touched mysql 
yet. Its a straight representation from PHP.


Notes:
1. Spaces in DB table/field names are a really bad idea and should be 
avoided if possible. Replace the spaces with underscores if you want 
the appearance of the space



Bastien



From: Renich Bon Ciric [EMAIL PROTECTED]
To: php-db@lists.php.net
Subject: [PHP-DB] Possible MySQLi extension BUG!
Date: Fri, 09 Sep 2005 12:50:31 -0500

Ok,

Firs of all, I wanna say I have spent a whole week looking for 
answers elsewhere. The reason of this message is to look for a 
practical solution.


My Systems:
Server:
Fedora Core 4 (up2dated)
PHP5.04 (cli)
MySQL 14.7 Distrib 4.1.12
using mysqli extension
Apache/2.0.54 (Fedora)

Workstation:
Windows XP SP2
Zend Studio Enterprise 4.02

Well, let me explain the problem:

I'm developing some aplications that require the use of foreign 
characters. The language is spanish, so you use accends or tilde on 
some works (example, comisión, niño, etc).


I have a simple query that uses tables (named with this foreign 
characters). Example:


directorio
- Empresa
- Dirección
- Asistente de Dirección

A query to this database should be as follows:

SELECT *
FROM `Asistente de Dirección`;

This returns an error like:

Table 'directorio.Asistente de Dirección' doesn't exist.

I have changed EVERYTHING to utf-8 charset:

httpd.conf - AddDefaultCharset = UTF-8
php.ini - default_charset = UTF-8
  mbstring.internal_encodign = UTF-8
  mbstring.http_input = UTF-8
  mbstring.http_output = UTF-8
  mbstring.detect_order = UTF-8,SJIS,ASCII
my.cnf - [mysqld]
 datadir=/var/lib/mysql
 socket=/var/lib/mysql/mysql.sock
 old_passwords=1
 default-character-set=utf8
 [mysql.server]
 user=mysql
 basedir=/var/lib

 [mysqld_safe]
 err-log=/var/log/mysqld.log
 pid-file=/var/run/mysqld/mysqld.pid

 [mysql]
 default-character-set=utf8

This config sets ALL my servers to utf-8

- Apache works perfectly fine in UTF-8, no problems
- PHP encodes everything to utf-8... at least thats what i think
- All my MySQL char variables are set to UTF-8, except 
default-character-result its set to NULL


As far as I know, there is no other config made to be done.

My theory is this:

Consider:

?php

$link = mysqli_connect('mysql.fedora', 'root', 'idontrecall', 
'directorio');


if ( isset($_POST['submit'])  $_POST['submit'] == 'Search' )
{
$query = SELECT *
  FROM `Empresa`,
  `Presidente`,
  `Asistente de Presidencia`,
  `Director`,
  `Asistente de Dirección`, `
  Centro de Distribución 01`,
  `Centro de Distribución 02`,
  `Centro de Distribución 03`,
  `Centro de Distribución 04`,
  `Centro de Distribución 05`,
  `Centro de Distribución 06`,
  `Centro de Distribución 07`,
  `Centro de Distribución 08`,
  `Centro de Distribución 09`,
  `Centro de Distribución 10`

WHERE Empresa.Emp_Gro LIKE '%$_POST[input]%'
AND Empresa.ID =  Presidente.ID
AND Empresa.ID = `Asistente de Presidencia`.ID
AND Empresa.ID =  Director.ID
AND Empresa.ID = `Asistente de Dirección`.ID
AND Empresa.ID = `Centro de Distribución 01`.ID
AND Empresa.ID = `Centro de Distribución 02`.ID
AND Empresa.ID = `Centro de Distribución 03`.ID
AND Empresa.ID = `Centro de Distribución 04`.ID
AND Empresa.ID = `Centro de Distribución 05`.ID
AND Empresa.ID = `Centro de Distribución 06`.ID
AND Empresa.ID = `Centro de Distribución 07`.ID
AND Empresa.ID = `Centro de Distribución 08`.ID
AND Empresa.ID = `Centro de Distribución 09`.ID
AND Empresa.ID = `Centro de Distribución 10`.ID;

// Make the query
$result = mysqli_query($link,$query) or die(mysqli_error($link));

// Fetch the results
while ($data = mysqli_fetch_assoc($result))
{
// Print the data obtained
print_my_data($data);
}

}
// Close conection
mysqli_close($link);

?

if you add a print $query; just before it makes the query; and as 
long as you have your webpage with the charset meta-tag set to 
utf-8 and everything utf-8 encoded... you'll get the right query...


this is

SELECT * FROM `Empresa`, `Presidente`, `Asistente de Presidencia

Re: [PHP-DB] Possible MySQLi extension BUG!. .

2005-09-09 Thread Patel, Aman


Renich Bon Ciric wrote:


Firs of all, I wanna say I have spent a whole week looking for answers 
elsewhere. The reason of this message is to look for a practical solution.




I just spent the last 2-3 days converting my entire database (and 
website) from charset latin1 (ISO-8859-1) to utf8. Although I used the 
mysql library instead of the mysqli library I believe this should help:


SET NAMES 'utf8';

Execute that query before you execute any other query that is going to 
use characters that are encoded in utf8. If you would like more 
information on what the above statement does here's the link to the 
mysql documentation:


http://dev.mysql.com/doc/mysql/en/charset-connection.html

- Aman

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



Re: [PHP-DB] Possible MySQLi extension BUG!. .

2005-09-09 Thread Renich Bon Ciric




Actually,

If you add the following line to my.cnf you'll get the same results,
permanently

[mysql]
default-character-set=utf8

[mysqld]
default-character-set=utf8

The last statement should be added AFTER all other configs... if not,
it will not work. In other works, add the line at the end of the
[mysqld] section.

Patel, Aman wrote:

Renich Bon Ciric wrote:
  
  
Firs of all, I wanna say I have spent a whole week looking for answers
elsewhere. The reason of this message is to look for a practical
solution.


  
  
I just spent the last 2-3 days converting my entire database (and
website) from charset latin1 (ISO-8859-1) to utf8. Although I used the
mysql library instead of the mysqli library I believe this should help:
  
  
SET NAMES 'utf8';
  
  
Execute that query before you execute any other query that is going to
use characters that are encoded in utf8. If you would like more
information on what the above statement does here's the link to the
mysql documentation:
  
  
http://dev.mysql.com/doc/mysql/en/charset-connection.html
  
  
- Aman
  
  
  
  
  



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