Poniżej wklejam kod pliku index.php:
<xml version="1.0" encoding="iso-8859-2"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl"> <head> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" /> <meta name="Description" content=" [wstaw tu opis strony] " /> <meta name="Keywords" content=" [wstaw tu slowa kluczowe] " /> <meta name="Author" content=" [dane autora] " /> <meta name="Generator" content="kED" /> <title> Moja strona </title> <link rel="stylesheet" href=" style.css " type="text/css" /> </head> <body> <div id = "top"> Nagłówek </div> <div id = "content"> <div id = "content-left"> BUM </div> <div id = "content-right"> <?php $db_obj = new mysqli("localhost","Mate","dom","ludzie"); if($db_obj->connect_errno) { exit; } else { } $query = 'SELECT * FROM człowiek'; if($result = $db_obj->query($query)) { ?> <table> <?php while($row = $result->fetch_row()) { } ?> </table> <?php } else { } if ($db_obj->close()) { } else { } ?> </table> </div> </div> <div id = "bot"> Stopka </div> </body> </html>
A poniżej to co wyświetla się w najważniejszym oknie, czyli odczyt kilku wierszy z bazy danych (w PHPMyAdmin zapytanie działa bez problemu):
Połączenie z Bazą zostało nawiązane ...
Wystąpił błąd: nieprawidłowe zapytanie ...
Warning: mysql_error() expects parameter 1 to be resource, object given in C:\WebServ\httpd\index.php on line 72
Połączenie z serwerem MySQL zostało zamknięte ...
Gdzie jest problem?