我试图通过使用getCity()函数来获取cit名称,但遗憾的是它不适用于我。请帮忙。
$sql =("
SELECT
distinct orders.id as 'Order Id',
users.email,
orders.price as 'Amount',
orders.at as 'Date and Time',
'".getCity($id)."' as 'CITY'
FROM users, orders, order_history, users_address
WHERE
users.id = order_history.uid
AND orders.id = order_history.oid
AND orders.real = 1 AND orders.price > 1
AND orders.payment_status = 1 AND orders.status = 1
ORDER BY orders.id;
");
答案 0 :(得分:0)
您只能使用此功能的结果:
def __init__(self, parent=None):
super(Program, self).__init__(parent)
...code...
self.connect(self.showDetailsButton, SIGNAL("clicked()"), self.showTextBrowser)
self.textBrowser.hide() #hide the textbrowser by default
self.resize(461, 200)
self.connect(self.hideDetailsButton, SIGNAL("clicked()"), self.hideTextBrowser)
self.hideDetailsButton.hide() #hide the hideDetailsButton by default
...code...
def showTextBrowser(self):
self.textBrowser.show()
self.hideDetailsButton.show()
self.showDetailsButton.hide()
self.resize(461, 444)
def hideTextBrowser(self):
self.textBrowser.hide()
self.showDetailsButton.show()
self.hideDetailsButton.hide()
self.resize(461, 200)
...code...
在这种情况下,$result = getCity($id);
$sql =("
SELECT
distinct orders.id as 'Order Id',
users.email, orders.price as 'Amount',
orders.at as 'Date and Time',
'$result' as 'CITY'
FROM users, orders, order_history, users_address
WHERE users.id = order_history.uid
AND orders.id= order_history.oid
AND orders.real = 1 AND orders.price > 1
AND orders.payment_status = 1 AND orders.status = 1
order by orders.id;
");
只能是字符串。始终是相同的字符串 - 对于您可以从DB获得的每一行。
如果$result
是列的名称,则应在查询中不加$result
。