ID:               29582
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mydwin at msn dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         MySQL related
 Operating System: Windows 2003 Enterprise
 PHP Version:      5.0.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This is expected behavior, use some parenthesis to separate your
assignments from your boolean logic.

Also, take a look at DB::getOne(), it'll simplify what you're trying to
do here.



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

[2004-08-09 08:53:24] mydwin at msn dot com

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];

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

[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