这是我的代码:
<?php
$_SETTINGS = $GLOBALS["_SETTINGS"];
$trigger = $_SETTINGS->fields->trigger->value;
echo $trigger . " = " . $_GET[$trigger] . "</br>";
$townQry = "SELECT * FROM towns WHERE id = '" . $_GET[$trigger] . "'";
echo $townQry . "</br>";
$result = mysql_query($cityQry) or die('Could not retreive towns: ' . mysql_error());
while ($town = mysql_fetch_assoc($result)) {
echo $town["town_name"];
}
?>
这就是它的回声:
town_id = 2
SELECT * FROM towns WHERE id = '2'
Could not retreive towns: Query was empty
SQL 不是有效的...!?