MySQL查询从表中获取主键(customer_id)并将其与当前会话ID(customer_id)进行比较(MySQL query to get the primary key(customer_id) from a table and to compare it with the current session id(customer_id))
我运行此代码时出现此错误。
第32行的C:\ xampp \ htdocs \ pta \ cc11205 \ booking.php中的分析错误:语法错误,意外的“”“(T_CONSTANT_ENCAPSED_STRING)
$querycust = mysql_query(" SELECT * FROM customer WHERE customer_id = ".$_SESSION['customer_id']" ");
TQ。
i' having this error when i run this code.
Parse error: syntax error, unexpected '" "' (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\pta\cc11205\booking.php on line 32
$querycust = mysql_query(" SELECT * FROM customer WHERE customer_id = ".$_SESSION['customer_id']" ");
tq.
原文:https://stackoverflow.com/questions/16499583
更新时间:2019-09-19 02:01
最满意答案
您的查询中存在语法错误,请将查询更改为此
$querycust = mysql_query(" SELECT * FROM customer WHERE customer_id = '".$_SESSION['customer_id']."' ");
You have a syntax error in your query, Change your query to this
$querycust = mysql_query(" SELECT * FROM customer WHERE customer_id = '".$_SESSION['customer_id']."' ");
2013-05-11
相关问答
Update ch
set ch.sales_code = ...,
ch. ProductQuantity =...,
from Customer_Sales_History ch join Customer c on ch. Customer_ID= c.Customer_ID
where ch.Customer_ID=2
Update ch
set ch.sales_code = ...,
ch. ProductQuantity =...,
from Customer_
...
您需要使用LAST_INSERT_ID()函数: http : //dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_last-insert-id 例如: INSERT INTO table_name (col1, col2,...) VALUES ('val1', 'val2'...);
SELECT LAST_INSERT_ID();
这将返回您插入的最后一行的PRIMARY KEY值: 生成的ID在每个连
...
你可以使用NOT EXISTS() : SELECT * FROM YourTable t
WHERE t.date <= '2015-12-31 23:59:59'
AND NOT EXISTS(SELECT 1 FROM YourTable s
WHERE t.customer_id = s.customer_id
AND t.date < s.date)
这将仅选择日期过滤器之后的记录,其中NOT EXISTS具有更大日期的
...
您的查询中存在语法错误,请将查询更改为此 $querycust = mysql_query(" SELECT * FROM customer WHERE customer_id = '".$_SESSION['customer_id']."' ");
You have a syntax error in your query, Change your query to this $querycust = mysql_query(" SELECT * FROM customer WHERE cus
...
您可以通过sales_flat_order_address表中的customer_address_id字段获取客户地址 这里的代码: $order = Mage::getModel('sales/order');
$order->loadByIncrementId($ext_order_id);
$address = $order->getShippingAddress();
$address->getData('customer_address_id');
you can get custom
...
嗯,我想你只想要最新订单的日期和大案例陈述。 像这样的东西: select o.customer_id,
(case when max(date_created) >= date_sub(now(), interval 2 week) then 1
when max(date_created) >= date_sub(now(), interval 4 week) then 2
when max(date_created) >= d
...
尝试这个 mysql_query("INSERT INTO notification (cus_id,notification)
VALUES('$k','Thank you for reserving in Saint Michael Parish. Your
Current Reservation is still ( PENDING ) ...'");
try this mysql_query("INSERT INTO notification (cus_id,notification)
...
一个天真的解决方案: -- Just number them
UPDATE purchases SET customer_id = rownum;
-- Group all customers with given matchcode_1 into one
MERGE INTO purchases p
USING (SELECT matchcode_1, min(customer_id) customer_id
FROM purchases
GROUP BY match
...
尝试使用session_id() session_start();
echo $ses_id = session_id();
更多信息: - http://php.net/manual/en/function.session-id.php try with session_id() session_start();
echo $ses_id = session_id();
For more :- http://php.net/manual/en/function.sessi
...