I am trying to get the cit name by using getCity() function, but Unfortunately it does not works for me. Please help.
$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;
");
You only can use result of this function:
$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;
");
In this case $result
can be only string. Always the same string - for each row which you can get from DB.
If $result
will be name of column you should put it without '
in your query.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.