One thing that has always bothered me is that when I check my php scripts for problems, I get a "bool-assign: Assignment in condition" warning, and I get a lot of them. eg:.
$guests = array(); $sql = "SELECT * FROM `guestlist`"; $result = mysql_query($sql); while($row = mysql_fetch_assoc($result)) $guests[] = $row['name'];
Is there any other way to get some or all of the rows in an object or array? Or is there nothing wrong with this method?
try to do this instead:
$guests = array(); $sql = "SELECT * FROM `guestlist`"; $result = mysql_query($sql); while(($row = mysql_fetch_assoc($result)) !== false) $guests[] = $row['name'];
I believe php warns because of $ row = mysql_fetch_assoc ($ result) not returning a boolean.
, , , . :
if (something == something_else)
:
if (something = something_else)
, , . PHP - C, , :
while(($row = mysql_fetch_assoc($result)))
, , PHP .
Source: https://habr.com/ru/post/1705919/More articles:.net: how to debug XmlSerializer.Deserialize errors? - .netWhat setup do you use for SharePoint development (WSS / MOSS)? - sharepointHow do you create a user control in UIKIt? - iphoneHttp Protocol Content Length - httpНаписание плагинов для Adobe (Reader и PhotoShop) с использованием .NET(С#) - pluginsПриложение Iphone, объектно-ориентированные дизайнерские идеи - design-patternsBesides dynamic input, what makes Ruby “more flexible” than Java? - javaShould I use an algorithm or manual code in this case? - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1705923/how-to-bring-visual-studio-features-to-eclipse&usg=ALkJrhgD0eZnai_XnKuKwXKPHxn6AGbRqQChanging tab title in wx.Notebook - pythonAll Articles