PHP a mysql_fetch_array function problem

Source: Internet
Author: User
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)) {}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.