Home > Backend Development > PHP Tutorial > 未定义的变量!该怎么解决

未定义的变量!该怎么解决

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:27:55
Original
3561 people have browsed it

未定义的变量!
源代码!

function OpenDB($SQL){
$link = mysql_connect($server_DB, $user_DB, $password_DB)or die("Could not connect:".mysql_error());
mysql_select_db($database_DB, $link);
$result = mysql_query($SQL);
return $result;
}

OpenDB("select * from config WHERE ID = 1");
$row = mysql_fetch_array($result);
echo $row["className"];

错误提示!
Notice: Undefined variable: result in E:\wwwroot\include\config.int.php on line 36
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in E:\wwwroot\include\config.int.php on line 36

------解决方案--------------------
$result=OpenDB("select * from config WHERE ID = 1");
$row = mysql_fetch_array($result);

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template