单引号,双引号和“未定义索引” [英] single quotes, double quotes and "undefined index"

查看:88
本文介绍了单引号,双引号和“未定义索引”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写干净的代码,但在决定引用数组索引时什么时候一直无法确定

什么时候引用数组索引?什么时候不引用。


有时当我引用时双引号内的数组索引我

得到一个关于空白空间的错误(给我最好的记忆)


其他时候我得到一个未定义的索引通知下面:


注意:未定义索引:last_reminder_id in ...


第二行(在此帖子中包含第3行

是错误消息中列出的那个:


$ sql =" SELECT * from notes

其中recall_date''0' '和'recall_date< =''$ now''和id>

''$ _SESSION [last_reminder_id]''" ;;


什么是正确的语法和/或任何人都可以指向一个

参考来解释这个吗?


bill

解决方案

sql =" SELECT * from notes

where recall_ date''0''和recall_date< =''


now''和id>

''


< blockquote> _SESSION [last_reminder_id]''" ;;


什么是正确的语法和/或任何人都可以指向我的

引用来解释这个?


账单


I am trying to write clean code but keep having trouble deciding
when to quote an array index and when not to.

sometimes when I quote an array index inside of double quotes I
get an error about enased whitespace (to my best memory)

AT other times I get an undefined index notice as below:

Notice: Undefined index: last_reminder_id in...

the 2nd line (which wraps to the 3rd in this posting
is the one listed in the error message:

$sql = "SELECT * from notes
where recall_date ''0'' and recall_date <= ''$now'' and id >
''$_SESSION[last_reminder_id]''";

what is the correct syntax and/or can anyone point me at a
reference that will explain this ?

bill

解决方案

sql = "SELECT * from notes
where recall_date ''0'' and recall_date <= ''


now'' and id >
''


_SESSION[last_reminder_id]''";

what is the correct syntax and/or can anyone point me at a
reference that will explain this ?

bill


这篇关于单引号,双引号和“未定义索引”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆