我想在一个单独的文件functions.php
来实现这两种功能,并调用它在index.php
为什么这个php函数会导致严重错误?
function is_field($column, $table, $requested) {
$is_field_query = "SELECT ".$column." FROM ".$table." WHERE ".$column."='".$requested."'";
$is_field_result = $mysqli->query($is_field_query);
$is_true = $is_field_result->num_rows;
$is_field_result->close();
return $is_true;
}
function get_content($column, $table, $requested) {
$get_content_query = "SELECT ".$column." FROM ".$table." WHERE ".$column."='".$requested."'";
$get_content_result = $mysqli->query($get_content_query);
$get_content_row = $get_content_result->fetch_array(MYSQLI_ASSOC);
$get_content_content = $get_content_row["content"];
$get_content_result->close();
return $content;
}
我一遍遍尝试一遍,我不知道为什么它不会工作。第一个返回1为有效或0为无效。第二个检索MySQL表中特定单元格的内容。任何帮助将非常感激。
什么是你得到的错误讯息? “错误500”不够详细。 – Dai 2013-03-12 03:37:38
打开错误报告http://stackoverflow.com/tags/php/info – Tchoupi 2013-03-12 03:37:40
'从“选择其中$栏=‘$要求’$表$栏”'你不需要翻来进出引号像如果你的字符串是双引号的。 – 2013-03-12 03:41:09