尽管class IntentHandler : LuisDialog<object>
{
private string userToBot;
protected override async Task MessageReceived(IDialogContext context, IAwaitable<IMessageActivity> item)
{
var message = await item;
//No way to get the message in the LuisIntent methods so saving it here
userToBot = message.Text.ToLowerInvariant();
if (message.Type != ActivityTypes.Message)
{
await base.MessageReceived(context, item);
return;
}
if (!await context.IsUserAuthenticated(m_resourceId))
{
await context.Forward(new AzureAuthDialog(m_resourceId), ResumeAfterAuth, message, CancellationToken.None);
}
else
{
await base.MessageReceived(context, item);
}
}
private async Task ResumeAfterAuth(IDialogContext context, IAwaitable<string> result)
{
var message = await
await context.PostAsync(message);
Activity activity = (Activity)context.Activity;
//Store the saved message back to the activity
activity.Text = userToBot;
//Reset the saved message
userToBot = string.Empty;
//Call the base.MessageReceived to trigger the LUIS intenet
await base.MessageReceived(context, Awaitable.FromItem(activity));
}
}
中存在obj
search
,但我得到一个空白element
。
这是我正在尝试的
database
我没有得到任何 $userInput = 'john';
$db = getDB();
$sql = "SELECT user_id, email, token FROM users WHERE name LIKE name=:input";
$stmt = $db->prepare($sql);
$stmt->bindParam("input", $userInput,PDO::PARAM_STR);
$stmt->execute();
$usernameDetails = $stmt->fetch(PDO::FETCH_OBJ);
print_r($usernameDetails );
。
请帮帮我。
答案 0 :(得分:0)
在您的查询中,您使用了一种奇怪的方法:
WHERE name LIKE name=:input
name
喜欢什么?
你要么用
SELECT user_id, email, token FROM users WHERE name=:input
或
SELECT user_id, email, token FROM users WHERE name LIKE :input
如果是LIKE
,我认为您需要添加%
,否则LIKE
会变为=
:
// previous code here
$stmt = $db->prepare($sql);
$stmt->bindParam("input", '%' . $userInput . '%' ,PDO::PARAM_STR);
// more code here
答案 1 :(得分:0)
LIKE
运算符
name LIKE name=:input";
您需要将其更改为
$query = $db->prepare('SELECT user_id, email, token FROM users WHERE name LIKE :input');
$query->bindParam("input", "%$userInput%", PDO::PARAM_STR);
注意: %
表示任何字符。