mysqli_query 中的重音而不是 '' [英] Grave accents instead of '' in mysqli_query

查看:35
本文介绍了mysqli_query 中的重音而不是 ''的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个问题,我在谷歌上找过,没有找到.

I have a problem, I looked for it on google, couldn't find it.

$result = mysqli_query($link,"SELECT * FROM  update ");

错误

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in

当我将查询更改为:

$result = mysqli_query($link,"SELECT * FROM  `update` ");

它有效.这是为什么?

推荐答案

那些不是重音"(重音在字母之上);它们是反引号.

Those are not "grave accents" (accents go above letters); they are backticks.

您应该用反引号将字段名称括起来,以表明它们是字段名称,而不是函数、运算符、命令等.

You're supposed to surround field names with backticks, to show that they are field names and not functions, operators, commands, etc.

您通常可以不这样做而逃脱(而且您似乎已经很习惯了!),但如果您的名字实际上是 MySQL 保留的关键字 —例如,UPDATE —你不能.

You can usually get away without doing that (and it would seem that you are quite used to it!), but in the case that your names are in fact MySQL reserved keywords — for example, UPDATE — you can't.

这篇关于mysqli_query 中的重音而不是 ''的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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