Php运算符和析构函数
谁能告诉我Php运算符和析构函数,php,Php,谁能告诉我$sql=中发生了什么。。。声明。。。意思是我不能理解点的功能 请详细解释。Widget是mysql中的一个表,包含widgetid、名称、描述等列。附加到字符串 function _destruct() {if(!this->needsupdate) return; $sql='update widget set'; $sql.="name =".mysql_real_escape_string($this->name)."',"; $s
$sql=
中发生了什么。。。声明。。。意思是我不能理解点的功能
请详细解释。Widget是mysql中的一个表,包含widgetid、名称、描述等列。附加到字符串
function _destruct()
{if(!this->needsupdate)
return;
$sql='update widget set';
$sql.="name =".mysql_real_escape_string($this->name)."',";
$sql.="description=".mysql_real_escape_string($this->description)."'";
$sql.="where widgetid=".this->id;
$rs=mysql_query($query,$this->connect);
if(!is_resource($rs))
throw new exception("an error occured updating the database");
mysql_close;
}
你的$sql
$x = "a";
$x .= "b";
echo $x; // "ab"
应该是:
update widget set name = something', description = something' where widgetid = 1;
附加到字符串
function _destruct()
{if(!this->needsupdate)
return;
$sql='update widget set';
$sql.="name =".mysql_real_escape_string($this->name)."',";
$sql.="description=".mysql_real_escape_string($this->description)."'";
$sql.="where widgetid=".this->id;
$rs=mysql_query($query,$this->connect);
if(!is_resource($rs))
throw new exception("an error occured updating the database");
mysql_close;
}
你的$sql
$x = "a";
$x .= "b";
echo $x; // "ab"
应该是:
update widget set name = something', description = something' where widgetid = 1;
“点”执行
文档中的示例:
UPDATE widget SET name = 'something', description = 'something' WHERE widgetid = 1
点执行
文档中的示例:
UPDATE widget SET name = 'something', description = 'something' WHERE widgetid = 1
SQL关键字不必是大写的。你用大写写关键字吗?我做什么都不重要。但我现在明白了,我想你实际上是指缺少的引号。你应该明确地写这篇文章,以免造成误解;)(就像在我的例子中:o)是的,这就是我所说的“应该是”;)大写、小写都不重要,但我更喜欢大写。SQL关键字不必是大写。你用大写写关键字吗?我做什么都不重要。但我现在明白了,我想你实际上是指缺少的引号。你应该明确地写这篇文章,以免造成误解;)(就像在我的例子中:o)是的,这就是我所说的“应该是”;)大写,小写,没关系,但我更喜欢大写。