我喜欢认为我对 php 非常了解,但这让我感到困惑。
保持基本我有:
function req_new($pname, $use=null, $depID=null, $manID=null, $manName=null, $suppID=null, $suppName=null, $cat=null, $brand=null, $name, $email, $custom_code, $user=null, $method=null)
{
//validation
if($pname == ''){return false;}
if($manID==null AND $manName==null){return false;}
foreach(func_get_args() as $arg)
{
$arg = fquery_sanitize($arg);
}
//submit new request
$sql = "insert into sds_product_requests ".
"(prodName, produse, depID, reqDate, manID, manName, suppID, suppName, prodCat, prodBrand, Name, Email, InternalC, `user`, method) ".
"VALUES ".
"('$pname','$use','$depID', NOW(),'$manID', '$manName', '$suppID', '$suppName', '$cat', '$brand', '$name', '$email', '$custom_code', '$user', $method)";
$result = fquery_db($sql);
if($result>1)
{return true;}
else
{return false;}
}
如果代码使用变量 name $name
,则它不起作用。改用另一个变量名,例如$pname
,它可以工作。如果我使用变量 name $name
,它会返回 false。
关于为什么会发生这种情况的任何想法?
调用函数
<?php
$name = getPOST('name');
$depID = getPOST('depID');
$cat = getPOST('cat');
$supp = getPOST('supp');
$suppID = getPOST('suppID');
$man = getPOST('man');
$manID = getPOST('manID');
$confirm = req_new('THIS IS A NAME', null, $depID, $manID, $man, $suppID, $supp, $cat, null, null, null, null, fauth_GetUserID(), 1);
?>