答案 0 :(得分:0)
我真的不明白你的意思。但你的意思是这样的:
<html>
<body>
<select>
<?php
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
include "$root/config.php";
$something1 = "something1";
$something2 = "something2";
$stmt = $pdo->prepare('SELECT DISTINCT from_mysql FROM customers WHERE something1 = :something1 AND from_mysql != :something2 ORDER BY from_mysql');
$stmt->execute(array(':something1' => $something1, ':something2' => $something2));
$results = $stmt->fetchAll();
if (empty($results)) {
echo 'Error: Please contact technical support!';
} else {
foreach( $results as $row ) {
echo "<option>".$row['from_mysql']."</option>";
}
}
?>
</select>
</body>
</html>
P.S。您必须使用索引。 php