mysql如何将数组数据放入表?

标签: html5 MySQL PHP
发布时间: 2016/10/20 4:59:15
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

我需要一些帮助 php 代码。 我想要与此查询进入简单的 php html 表的数据。

你们可以帮我了吗?

<?php

$konekcija=mysqli_connect("111.111.111.111","test","test123","publishers_instagram_accounts");
if (mysqli_connect_errno())
    die ("Error:".mysqli_connect_error());

$select = "select * from publishers_instagram_accounts where followed_id <= (select followed_id from publishers_instagram_accounts where username='zika')*1.2 and followed_id >= (select followed_id from publishers_instagram_accounts where username='zika')*0.8";

$stmt = mysqli_prepare($konekcija, $select);

if (mysqli_error($konekcija))
    die ("Error:" . mysqli_error($konekcija));

mysqli_stmt_bind_param($stmt, "ss", $trazi1, $trazi2);

if (!mysqli_stmt_execute($stmt))
{
    die ("Error:" . mysqli_stmt_error($stmt));
}
else
{
    $rezultat = mysqli_stmt_get_result($stmt);

    while ($red = mysqli_fetch_array($rezultat, MYSQL_ASSOC))
    {
        var_dump($red);
    }
}

解决方法 1:

while ($red = mysqli_fetch_array($rezultat, MYSQL_ASSOC)) {
 echo "
 <table>
  <thead>
    <td>Username</td>
    <td>Password</td>
  </thead>
  <tbody>
    <td>$red['username']</td>
    <td>$red['password']</td>
  </tbody>
</table>
 ";
}

像这种事情。希望它能帮助你。

官方微信
官方QQ群
31647020