hallo ich hab ein php script geschrieben aber es funktioniert nicht. leider weiss ich nicht wo der fehler ist:
1 | <?php
|
2 | /**
|
3 | * Looks in the database to see if a record or records exist
|
4 | *
|
5 | * @param String $string_dbhost - MySQL host.Can be either a host name or an IP address
|
6 | * @param String $string_dbusername - MySQL user name
|
7 | * @param String $string_dbpassword - MySQL user password
|
8 | * @param String $string_dbname - MySQL database name
|
9 | * @param Mysqli &$mysqli_link - MySQL link identifier
|
10 | * @return Boolean
|
11 | **/
|
12 | function connect_mysqldatabase($string_dbhost, $string_dbusername, $string_dbpassword, $string_dbname, &$mysqli_link) |
13 | {
|
14 | $mysqli_link = new mysqli($string_dbhost, $string_dbusername, $string_dbpassword, $string_dbname); |
15 | if (!$mysqli_link) { |
16 | /*echo "Error: Unable to connect to MySQL." . PHP_EOL;
|
17 | echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
|
18 | echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
|
19 | */
|
20 | return false; |
21 | }
|
22 | else
|
23 | {
|
24 | return true; |
25 | }
|
26 | }
|
27 | |
28 | var $mysqli; |
29 | if (connect_mysqldatabase("host","user","password","dbname",$mysqli)) |
30 | echo "ok"; |
31 | }
|