while($row = mysql\_fetch\_array($result)){}Cycle
Now I'm going to convert one of the variables in the database into another variable, but the last item in the array cannot be converted normally. What is the reason for this?
Specific code:
while($row = mysql_fetch_array($result)){ $id=$row['id']; $content=$row['content']; echo ""; //把.class为message里的变量转换为html代码 echo "$content";}
Reply content:
while($row = mysql\_fetch\_array($result)){}Cycle
Now I'm going to convert one of the variables in the database into another variable, but the last item in the array cannot be converted normally. What is the reason for this?
Specific code:
while($row = mysql_fetch_array($result)){ $id=$row['id']; $content=$row['content']; echo ""; //把.class为message里的变量转换为html代码 echo "$content";}
In fact, your problem is not in PHP, but in the JS that the head.
Think it could be because of $ ('. Message '). emotionstohtml (); There were so many times that there were problems with the order of execution.
It is recommended that this script be placed outside the loop, preferably in the body's onload, or in other places where it can be triggered when all is fully loaded.
Mysql_fetch_array method can only not return data from a database field name, you can var_dump $row confirm array.
To return an array with the field name subscript, there are two ways
while ($row = Mysql_fetch_array ($result, Mysql_num)) {}
Or
while ($row = Mysql_fetch_assoc ($result)) {}