Re: [PHP-DB] PHP/MySQL UTF-8 SNAFU

2007-07-13 Thread OKi98

Charles Sheinin napsal(a):
Ok, so I have a fully UTF-8 MySQL database with a fully UTF-8 table. I 
have a php page which has meta http-equiv=content-type 
content=application/xhtml+xml; charset=utf-8 / at the top of the 
html section and mysql_set_charset(utf8); after my connection 
(it's php 2.2.3, so that's more or less the same as mysql_query(SET 
NAMES 'utf8');/(SET SESSION character_set_client = utf8);, though 
I tried all that too, anyway).  I have all my php.ini mbstring stuff 
configured for utf-8:


mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.encoding_translation = On
mbstring.detect_order = auto

and for what it's worth, echo mb_internal_encoding(); reports UTF-8.

when I run a query that pulls out (in this case, Japanese, but say 
any) UTF8 data, it displays properly in MySQL Query Browser.  With php 
in the above context however, it does not.  Instead, it prints a ? 
corresponding to each character.  When I use mb_detect_encoding(); on 
each such string, it tells me they are encoded as ASCII.  The nearest 
I can tell is that somewhere between using mysql_query() and 
mysql_fetch_row(), things got messed up.  Is this a bug?  Is there 
something I'm missing?  Any clues? Help!



do you have

*meta http-equiv=Content-Type content=text/html; charset=utf-8*

header in your script?

OKi98

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



Re: [PHP-DB] Individual Array Entries

2007-07-13 Thread James Gadrow

Here's how you can fill a multi-dimensional array:

$days = array(); //Declare $days
to be an array
while ($row = mysql_fetch_assoc($result)) //set variable $row to be an
associative array containing a row of results from your mysql query
   array_push($days, $row);  //Inserts a new record
into $days and stores $row in it. This creates a multi-dimensional array

Or, if you want it associative:

$days = array();
while ($row = mysql_fetch_assoc($result))
   $days['whatever here'] = $row;

Hope that helps!

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



Re: [PHP-DB] PHP MySQL Issue!

2007-07-13 Thread Dwight Altman


On Jul 12, 2007, at 9:50 PM, Austin C wrote:

Hello, I dont get any errors. Just a blank page. But, I go to the  
database,

and it did what I told it to with the header table, but not with the
circulation table.


Check your error log or add this as the first line in your script.
ini_set('display_errors', '1');

Maybe you are testing this on a production server with errors not  
displayed.


Remove the line before you deploy the code.

Hopefully you will see a meaningful message now.

Regards,
Dwight




Re: [PHP-DB] PHP MySQL Issue!

2007-07-13 Thread Dwight Altman


On Jul 12, 2007, at 9:50 PM, Austin C wrote:

Hello, I dont get any errors. Just a blank page. But, I go to the  
database,

and it did what I told it to with the header table, but not with the
circulation table.


After you built the SQL for the circulation table, you did not  
execute it [with a $query = mysqli_query($cxn,$sql);].  Instead, you  
selected the db again.  Your code did what you told it to do.  Hence,  
no error messages.



Regards,
Dwight




[PHP-DB] MySQL user anHTACCESSusername not found?

2007-07-13 Thread Instruct ICC

In my apache web server error log, I see the following:

[Fri Jul 13 11:19:55 2007] [error] [client an.ip.addr.ess] MySQL ERROR: 
Can't connect to MySQL server on 'mysql.server.ip.address' (110)
[Fri Jul 13 11:19:55 2007] [error] [client an.ip.addr.ess] MySQL user 
anHTACCESSusername not found: /path/to/webpage


I can understand the first log entry; the client machine cannot contact the 
server machine at the moment.  (It cleared up without any changes as far as 
I can tell.  Perhaps a slow network?).


What I don't understand is why MySQL appears to be trying to authenticate 
the HTACCESS username.


Once the user logs in to the webpage with his HTACCESS username, the script 
connects to the MySQL server with the same MySQL login credentials for 
everyone.


Even with register_globals on (which I can't turn off), I am explicitly 
setting the $username variable in mysql_connect() which I call as 
mysql_connect($server, $username, $password) to use to connect to MySQL.


I'm on PHP 4.3.10, MySQL 4.1.20, sql.safe_mode is Off, mysql.default_user 
had no value.

Doesn't the web server own the process anyway?


From the docs:

mysql_connect username
   The username. Default value is defined by mysql.default_user. In SQL 
safe mode, this parameter is ignored and the name of the user that owns the 
server process is used.


mysql.default_user  string
   The default user name to use when connecting to the database server if 
no other name is specified. Doesn't apply in SQL safe mode.


Why is this second log entry present?  I don't see any place where I ask 
MySQL to authenticate an HTACCESS username.  Perhaps there is a default 
setting I can turn off?


Thanks.

_
http://imagine-windowslive.com/hotmail/?locale=en-usocid=TXT_TAGHM_migration_HM_mini_2G_0507

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