我目前的查询。我可以将它们组合成更少以获得相同的结果吗?我正在尝试将有关线索的特定信息放入名为 $trail 的数组中。
$result = mysql_query("SELECT meta_value FROM wp_postmeta WHERE `post_id` = $id AND `meta_key` = 'location_city' ");
$result = mysql_fetch_array($result);
$trail[city] = $result[0];
$result = mysql_query("SELECT meta_value FROM wp_postmeta WHERE `post_id` = $id AND `meta_key` = 'length' ");
$result = mysql_fetch_array($result);
$trail[length] = $result[0];
$result = mysql_query("SELECT meta_value FROM wp_postmeta WHERE `post_id` = $id AND `meta_key` = 'location_state' ");
$result = mysql_fetch_array($result);
$trail[state] = $result[0];
$result = mysql_query("SELECT meta_value FROM wp_postmeta WHERE `post_id` = $id AND `meta_key` = 'difficulty' ");
$result = mysql_fetch_array($result);
$trail[difficulty] = $result[0];
$result = mysql_query("SELECT guid FROM wp_posts WHERE `post_parent` = $id AND `post_type` = 'attachment' ");
$result = mysql_fetch_array($result);
$trail[image] = $result[0];