ID:               37001
 Updated by:       [EMAIL PROTECTED]
 Reported By:      cyclops at prof-x dot net
-Status:           Open
+Status:           Assigned
 Bug Type:         MySQL related
 Operating System: Linux (Debian Stable)
 PHP Version:      5.1.2
-Assigned To:      
+Assigned To:      georg


Previous Comments:
------------------------------------------------------------------------

[2006-04-06 21:39:37] cyclops at prof-x dot net

Hope this gives you enough information:

[23:37:04](root) elana:~# php phpinfo.php | grep 'Client API'
Client API version => 4.1.9
Client API version => 4.1.9
[23:37:10](root) elana:~# ldconfig -v | grep mysql
        libgmysqlbackend.so.0 -> libgmysqlbackend.so.0.0.0
/usr/local/mysql/lib/mysql:
        libmysqlclient.so.14 -> libmysqlclient.so.14.0.0
        libmysqlclient.so.12 -> libmysqlclient.so.12.0.0
        libmysqlclient_r.so.12 -> libmysqlclient_r.so.12.0.0
        libmysqlclient.so.12 -> libmysqlclient.so.12.0.0
        libmysqlclient_r.so.10 -> libmysqlclient_r.so.10.0.0
        libmysqlclient.so.10 -> libmysqlclient.so.10.0.0
[23:37:18](root) elana:~# /usr/local/mysql/bin/mysql_config 
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include/mysql]
        --include        [-I/usr/local/mysql/include/mysql]
        --libs           [-L/usr/local/mysql/lib/mysql -lmysqlclient
-lcrypt -lnsl -lm -lz]
        --libs_r         [-L/usr/local/mysql/lib/mysql -lmysqlclient_r
-lpthread -lcrypt -lnsl -lm -lpthread -lz]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [4.1.9]
        --libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld
-lpthread -lcrypt -lnsl -lm -lpthread -lrt -lcrypt -lnsl -lm -lz]
[23:37:32](root) elana:~# php -v
PHP 5.1.2 (cli) (built: Apr  6 2006 21:21:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
[23:37:48](root) elana:~# ls -al /usr/local/mysql/lib/
total 12
drwxr-sr-x   3 root mysql 4096 Sep  4  2003 .
drwxr-sr-x  11 root mysql 4096 Sep  4  2003 ..
drwxr-sr-x   2 root mysql 4096 Feb 15  2005 mysql
[23:38:16](root) elana:~# ls -al /usr/local/mysql/lib/mysql/
total 2056
drwxr-sr-x  2 root mysql   4096 Feb 15  2005 .
drwxr-sr-x  3 root mysql   4096 Sep  4  2003 ..
-rw-r--r--  1 root mysql  11798 Feb 15  2005 libdbug.a
-rw-r--r--  1 root mysql  43358 Feb 15  2005 libheap.a
-rw-r--r--  1 root mysql  15322 Feb 15  2005 libmerge.a
-rw-r--r--  1 root mysql 317812 Feb 15  2005 libmyisam.a
-rw-r--r--  1 root mysql  27710 Feb 15  2005 libmyisammrg.a
-rw-r--r--  1 root mysql 468356 Feb 15  2005 libmysqlclient.a
-rwxr-xr-x  1 root mysql    877 Feb 15  2005 libmysqlclient.la
lrwxrwxrwx  1 root mysql     24 Feb 15  2005 libmysqlclient.so ->
libmysqlclient.so.14.0.0
lrwxrwxrwx  1 root mysql     24 Sep  4  2003 libmysqlclient.so.12 ->
libmysqlclient.so.12.0.0
-rwxr-xr-x  1 root mysql 162062 Sep  4  2003 libmysqlclient.so.12.0.0
lrwxrwxrwx  1 root mysql     24 Feb 15  2005 libmysqlclient.so.14 ->
libmysqlclient.so.14.0.0
-rwxr-xr-x  1 root mysql 389446 Feb 15  2005 libmysqlclient.so.14.0.0
-rw-r--r--  1 root mysql 239160 Feb 15  2005 libmystrings.a
-rw-r--r--  1 root mysql 259472 Feb 15  2005 libmysys.a
-rw-r--r--  1 root mysql 101448 Feb 15  2005 libnisam.a
-rw-r--r--  1 root mysql   5942 Feb 15  2005 libvio.a

------------------------------------------------------------------------

[2006-04-06 21:18:14] [EMAIL PROTECTED]

What is the version of libmysqlclient? 
What is the version of MySQL server you're connecting to?

------------------------------------------------------------------------

[2006-04-06 20:44:26] cyclops at prof-x dot net

This code works in PHP 4.3.10, found the bug when i wanted to upgrade
to 5.x.
Mysql version is 4.1.9.

------------------------------------------------------------------------

[2006-04-06 20:37:50] cyclops at prof-x dot net

Description:
------------
I have some weird behaviour of mysql_fetch_array with mysql_assoc...

- Query: SELECT id, title, text, filename, timedate FROM news WHERE
deleted = 'N' ORDER BY timedate DESC LIMIT 0,5

- print_r of array returned by mysql_fetch_array($res, MYSQL_ASSOC):
Array
(
    [#B] => 133
    [   @] => Name
    [EMAIL PROTECTED] => Text
    [] => Filename
    [รก] => 2006-03-14 14:01:44
)

changing the query into results in this:
- Query: SELECT id, title, text , filename, timedate FROM news WHERE
deleted = 'N' ORDER BY timedate DESC LIMIT 0,5

- print_r of array returned by mysql_fetch_array($res, MYSQL_ASSOC):
Array
(
    [id] => 133
    [title] => Name
    [text] => Text
    [filename] => filename
    [timedate] => 2006-03-14 14:01:4
}

Note the space after 'text'. I also have some different result when i
change the limit from '0,5' to '1,5'.


This also breaks mysql_fetch_object returning a error:

PHP Fatal error:  Cannot access empty property in /root/text.php on
line 29


Reproduce code:
---------------
function GetLastNews($type = NULL) {
        $con = dbConnect();
        $arr = Array();

        $q2 = "SELECT id, title, text , filename, timedate FROM news
WHERE deleted = 'N' ORDER BY timedate DESC LIMIT 0,5";
        $res = mysql_query($q2,$con);
        if ($res) {
                while ($news = mysql_fetch_array($res,MYSQL_ASSOC)) {
                        print_r($news);
                }
                dbClose($con);
                return $arr;
        }
        dbClose($con);
        return NULL;
}


Expected result:
----------------
see description

Actual result:
--------------
see description


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37001&edit=1

Reply via email to