Undefined variable! Source code! FunctionOpenDB ($ SQL) {$ linkmysql_connect ($ server_DB, $ user_DB, $ password_DB) ordie (& quot; Couldnotconnect: & quot ;. mysql_error (); mysql_select_db ($ database_DB, $ link undefined variable!
Source code!
Function OpenDB ($ SQL ){
$ Link = mysql_connect ($ server_DB, $ user_DB, $ password_DB) or die ("cocould 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"];
Error message!
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
------ Solution --------------------
$ Result = OpenDB ("select * from config where id = 1 ");
$ Row = mysql_fetch_array ($ result );