我有这个代码输出 code1,code2 作为字符串。
我需要:
代码:
$db_host = "localhost";
$db_user = "////";
$db_pass = "////";
$db_name = "////";
// Establish a connection with the db
$conn = new mysqli($db_host, $db_user, $db_pass, $db_name);
if($conn->connect_error) {
die('connection failed');
}
$results = $conn->query('SELECT value FROM dcodes');
if($results->num_rows > 0) {
while($row = $results->fetch_assoc()) {
$row_str=implode(',', $row);
$row_arr[]=$row_str;
} array_unique($row_arr);
}
$new_row_str = implode(',', $row_arr);
echo $new_row_str;
$conn->close();
请帮助我。我不知道如何实现这一点但必须完成此事。谢谢。