如何将mysql表打印为行,列和值?

时间:2019-01-24 23:23:19

标签: php mysql arrays tabular

我正在尝试打印mysql表(例如列和行)的值,但我不知道该怎么做。

我正在创建一个名为“ recharge”的mysql表,其中包含“ id”,“ recharge_operator”,“ recharge_amount”列,我想在其中打印诸如列和行之类的值,但我不知道该怎么做。

如何获得这样的结果:

| Sold amount    | operator1       |  operator2      |  operator3 |   
|.......5€...... |..........6......| ......2.........|..........7......|
|.......10€......|..........1 .... |.......3.........|..........10.....|
| ......50€......|.........20 .....|.......15........|.........0.......|

数字为6的操作员1的数量等于5€

$sql = "CREATE TABLE IF NOT EXISTS recharge (
id_recharge INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
recharge_operator VARCHAR(30) NOT NULL,
recharge_amount VARCHAR(30) NOT NULL
)";
mysqli_query($conn, $sql);
if (mysqli_query($conn, $sql)) {
echo "</br>Table Recharge created successfully";
} else {
echo "Error creating table: " . $conn->error;
}

请帮助我。

0 个答案:

没有答案