我在我的 Wordpress 网站上使用 NinjaForm 插件,它运行良好,但我们希望创建一个自定义 .php 页面来输出一些提交的数据。
我们当前的文件是
<?php
$username = "SQLuser";
$password = "SQLpass";
$host = "localhost";
$connector = mysql_connect($host, $username, $password)
or die("Unable to connect");
$selected = mysql_select_db("wordpress", $connector)
or die("Unable to connect");
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Report</title>
</head>
<body>
<!--right-->
<?php
//execute the SQL query and return records
$result = mysql_query("SELECT * FROM wp_postmeta WHERE Meta_Key LIKE '%field%'");
?>
<table>
<thead>
</thead>
<tbody>
<?php
while ($row = mysql_fetch_assoc($result)) {
echo
"<tr>
<td>{$row['post_id']}</td>
<td>{$row['meta_key']}</td>
<td>{$row['meta_value']}</td>
</tr>";
}
?>
</tbody>
</table>
</body>
</html>
<?php mysql_close($connector); ?>
主要是从html 页面上的 mysql/phpmyadmin 显示数据中屠宰, 但这是在一个长列表中显示数据,如此屏幕截图
我们的目标是在表格中获取这些数据,其中包含每个字段的标题
例如
_field_5 = 姓名,
_field_8 = 食物,
_field_6 = 可以参加
DB 格式就像这张图片,所以数据一开始并没有保存在单独的列中,所以希望我们能够使用 php.ini 重新排列它。
有什么建议吗?