简体   繁体   English

PHP不允许使用多个函数参数的问题

[英]Issue with PHP not allowing multiple function parameters

is there an issue with PHP not allowing multiple function parameters and returning the correct value. PHP不允许多个函数参数并返回正确的值是否存在问题? Here is the code: 这是代码:

function getConfig($name) {
$sql = "SELECT value FROM config WHERE name = '".$name."'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
print $row["value"];
} 

getConfig("name");

While the code above works, the code bellow similar does not work. 虽然上面的代码有效,但是下面的代码却不起作用。 Here is the code: 这是代码:

function getConfig($name, $from) {
$sql = "SELECT value '".$from."' config WHERE name = '".$name."'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
print $row["value"];
} 

getConfig("name", "config");

Why does that occur that the 1st function works and the second does not? 为什么第一个功能起作用而第二个功能不起作用呢?

$sql = "SELECT value FROM '".$from."' WHERE name = '".$name."'";
//                   FROM TABLE_NAME
//           and not TABLE_NAME TABLE_NAME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM