ID:               29582
 User updated by:  mydwin at msn dot com
-Summary:          The Bug on if()
 Reported By:      mydwin at msn dot com
 Status:           Open
 Bug Type:         MySQL related
 Operating System: Windows 2003 Enterprise
 PHP Version:      5.0.0
 New Comment:

By the Way.

We can't use this

$Temp_From=$DB->query( "SELECT * FROM test WHERE id=$iFromID"
)->fetch_assoc()[0];


but we can use it in this way
$Temp_From=$DB->query( "SELECT * FROM test WHERE id=$iFromID"
)->fetch_assoc();
$Temp_From=$Temp_From[0];


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

[2004-08-09 08:43:17] mydwin at msn dot com

Description:
------------
-= The SQL is =-

CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `Name` varchar(50) collate utf8_bin NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=5
;


INSERT INTO `test` VALUES (1, 0x61);
INSERT INTO `test` VALUES (2, 0x62);
INSERT INTO `test` VALUES (3, 0x63);
INSERT INTO `test` VALUES (4, 0x64);






-= the test.php code is =-

<pre><?php
$iFromID       = $_POST["FromID"]|0;
$iToID         = $_POST["ToID"]|0;

$DB = new mysqli( "localhost", "root", "", "testDB" );
if( $Temp_From=$DB->query( "SELECT * FROM test WHERE id=$iFromID"
)->fetch_assoc() && $Temp_To=$DB->query( "SELECT * FROM test WHERE
id=$iToID" )->fetch_object() )
{
        print_r($Temp_From);
        echo "\n\n\n";
        print_r($Temp_To);
}
?>
<form method="post" action="test.php">
<input name="FromID" value="1" />  <input name="ToID" value="2" />
<input type="submit" value="Submit" /> <input type="reset"
value="Reset" />
</form>
</pre>





Expected result:
----------------
Array
(
    [id] => 1
    [Name] => a
)



stdClass Object
(
    [id] => 2
    [Name] => b
)

Actual result:
--------------
1


stdClass Object
(
    [id] => 2
    [Name] => b
)


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


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

Reply via email to