#28612 [Bgs]: Illegal offset type with mySQLi

From: Date: Thu, 03 Jun 2004 06:36:29 +0000
Subject: #28612 [Bgs]: Illegal offset type with mySQLi
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-60303@lists.php.net to get a copy of this message
ID: 28612 Updated by: derick@php.net Reported By: jsgoupil at lookstrike dot com Status: Bogus Bug Type: Arrays related Operating System: WinXP PHP Version: 5.0.0RC2 New Comment: With mysql a resource gets silently converted to the ID (interger) of the resource, as in mysqli this resource is an Object, we can't convert it. Nevertheless, this is very ugly coding, and should never have worked in the first place, but *that* we can not fix due to BC reasons. Previous Comments: ------------------------------------------------------------------------ [2004-06-03 02:54:03] jsgoupil at lookstrike dot com it is working with the version mysql_query ! so, it's why i'm posting ... we can use a mysql_query ressource in offset but not with mysqli_query ! ------------------------------------------------------------------------ [2004-06-03 01:01:11] pollita@php.net ...or mysql_query()/mysqli_query() for that matter. ------------------------------------------------------------------------ [2004-06-03 01:00:28] pollita@php.net Resources cannot be used as array offsets. This is just as true of mysql_connect() as it is of mysqli_connect(). ------------------------------------------------------------------------ [2004-06-02 23:08:09] jsgoupil at lookstrike dot com Description: ------------ When trying to put a ressource of mySQLi in the index of an array, i get the following error : Warning: Illegal offset type in ... I'm running PHP5.0.0RC2 and trying to connect a mySQL4.1 server. When i try to connect the php_mysql.dll (not advanced) to another server, i don't get the "illegal offset" with the same code. (mysql_connect function) Reproduce code: --------------- <?php $link = mysqli_connect("localhost","lookstrike","*****","lookstrike_local"); $query = mysqli_query($link,"SELECT player_id FROM ls_players"); $something = array(); $something[$query] = "1"; mysqli_close($link); ?> Expected result: ---------------- It supposed to work like mySQL (not avanced) Actual result: -------------- Warning: Illegal offset type in ... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28612&edit=1

« previous php.bugs (#60303) next »