libcha Posted July 22, 2010 Share Posted July 22, 2010 Hi, i wrote this piece of code: if (mysql_num_rows($res) != 1 || mysql_fetch_assoc($res)["id"] != $correct_id) do_something(); but it doesn't digest the usage of [] operator just after () operator... (i don't know wheather it's a bug or php is just stupid...) the only working solution is: if (mysql_num_rows($res) != 1) do_something(); else { $row = mysql_fetch_assoc($res); if ($row["id"] != $correct_id) do_something(); } but i don't want this, because there is the clause do_something() twice... any better solutions ? thanks much Link to comment https://forums.phpfreaks.com/topic/208519-unexpected-unexpected-error/ Share on other sites More sharing options...
Mchl Posted July 22, 2010 Share Posted July 22, 2010 I guess you can say PHP is just stupid (in this case). It does not support syntax like this. Link to comment https://forums.phpfreaks.com/topic/208519-unexpected-unexpected-error/#findComment-1089466 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.