PHP inside how to loop embedded HTML elements

Source: Internet
Author: User

  • Winning information



      $sql = "SELECT * from t_activity where memberid= ' $memberID '";
      $res = $db->getdata ($sql);

      while ($res)
      {
    • 1


    • }
      $obj = Mysqli_fetch_object ($res);
      ?>





  • As above, after extracting the data from the database, how to loop output the desired data from the database result set in the HTML Li?


    Reply to discussion (solution)

  • Winning information

      GetData ($sql); while ($obj = Mysqli_fetch_object ($res)) {?>
    • field;? >
  • Winning information

      GetData ($sql); while ($obj = Mysqli_fetch_object ($res)) {?>
    • field;? >

  • The great God is the great God! Worship!

    There is one more question to ask:
    $sql = "SELECT count (*) from t_activity where memberid= ' $memberID '";
    $res = $db->execsql ($sql);
    $num = Mysqli_num_rows ($res);
    Ask MySQL, how to count the number of rows in the query (*), with the above method has not been successful!


  • Winning information

      GetData ($sql); while ($obj = Mysqli_fetch_object ($res)) {?>
    • field;? >

  • The great God is the great God! Worship!

    There is one more question to ask:
    $sql = "SELECT count (*) from t_activity where memberid= ' $memberID '";
    $res = $db->execsql ($sql);
    $num = Mysqli_num_rows ($res);
    Ask MySQL, how to count the number of rows in the query (*), with the above method has not been successful!
    What do $num print out?



  • Winning information

      GetData ($sql); while ($obj = Mysqli_fetch_object ($res)) {?>
    • field;? >

  • The great God is the great God! Worship!

    There is one more question to ask:
    $sql = "SELECT count (*) from t_activity where memberid= ' $memberID '";
    $res = $db->execsql ($sql);
    $num = Mysqli_num_rows ($res);
    Ask MySQL, how to count the number of rows in the query (*), with the above method has not been successful!
    What do $num print out?

    Print out 1, but the database has 3

    Print out 1, but the database has 3
    Change Count (*) to *.

    Or you can do it.

    $row = Mysqli_fetch_row ($res); $num = $row [0];


    Print out 1, but the database has 3
    Change Count (*) to *.

    Great God!

    $num = Mysqli_fetch_row ($res);
    echo $num [0];

    Or
    List ($num) = Mysqli_fetch_row ($res);

    Or
    $num = Crrrent (Mysqli_fetch_row ($res));

  • 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.