mysql 查询会话id_MySQL查询从表中获取主键(customer_id)并将其与当前会话ID(customer_id)进行比较(MySQL query to get the primary k...

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

...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值