所以我的目标是将一些mysql信息输出到一个表中。我希望它每 18 条记录开始一个新列。这是我当前的代码:
$hostname = "localhost"; //SET SERVER/HOSTNAME
$dbusername = "username"; //SET DATABASE USERNAME
$dbname = "database"; //SET DATABASE NAME
$dbpassword = "password"; //SET DATABASE USERNAME
$link = mysqli_connect($hostname, $dbusername, $dbpassword, $dbname);
if (!$link)
{
die('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
}
$continent='Africa';
//GET AFRICA Countries
$sql = "SELECT country FROM countries WHERE continent = '$continent';";
$result = mysqli_query($link, $sql, MYSQLI_USE_RESULT);
if (!result)
{
echo 'Error: ', $mysqli->error;
}
while($row = $result->fetch_assoc()){
$country = $row['country'];
echo "$country<br>";
}
现在它只是在一个直列中输出列表,但我希望它在 x 次后开始一个新列。那有可能吗?