while True:
print "You wake up in a dim room. Cold water trickles down your spine through the rags you are wearing."
break
while True:
q1 = raw_input("Exit or Explore? ")
if q1 in ("explore", "Explore","EXPLORE",):
print "You search the room. All you find is a small, maroon object. You reach for it, but all of the sudden, it explodes. You are dead."
exit()
elif q1 in ("exit","EXIT","Exit",):
print "Light flashes before your eyes as you find yourself on a scenic mountaintop. It drops to the north and west. To the east is a winding road. In the distance you see a village."
else:
print "..."
q2 = raw_input("Which direction do you go? ")
if q2 in ("North","north","NORTH","West","west","WEST",):
print "You clumsily stumble off the cliff. You are dead."
exit()
elif q2 in ("east","EAST","East",):
print "You travel for a few hours and arrive at"
break
此方法有效,但行以这种方式排序-$str = "25,12,13,19";
$sql = "select id, src, link from banners where id in (" . $str . ")";
如何获取按12,13,19,25
值(即-$str
)排序的行?
答案 0 :(得分:1)
除非您对结果进行明确排序,否则引擎可以自由以任何顺序返回结果的行。要对结果进行排序,您必须包含一个ORDER BY
子句。在这里您可以使用field()
。它获取值在值列表中的位置。
SELECT d,
src,
link
FROM banners
WHERE id IN (25, 12, 13, 19)
ORDER BY field(id, 25, 12, 13, 19);