napisałem kod, który ma za zadanie wyświetlić wartości pobrane z bazy MySQL.
Przy wyświetlaniu wyskakuje mi błąd mysql_fetch_array() expects parameter 1 to be resource, object given in... (45 linijka kodu)
Generalnie podczas pisania w PHP kilka razy ten błąd mi się powtarzał, w różnych miejscach.
Prosiłbym o wytłumaczenie skąd się taki błąd bierze i jak go poprawić.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <?php //połączenie z bazą @ $kontakt = new mysqli("localhost", "user1", "user1", "hurtownia"); if (mysqli_connect_errno()){ exit; } $zapytanie = "select * from produkty"; $wynik = $kontakt->query($zapytanie); if ($wynik) { } else { } ?> <table width="400" border="0" cellspacing="1" cellpadding="0"> <tr> <td> <table width="400" border="1" cellspacing="0" cellpadding="3"> <tr> <td align="center" colspan="10"><strong>Produkty</strong> </td> </tr> <tr> <td align="center"><strong>ID</strong></td> <td align="center"><strong>Nazwa</strong></td> <td align="center"><strong>Producent</strong></td> <td align="center"><strong>Kategoria</strong></td> <td align="center"><strong>Cena</strong></td> </tr> <?php ?> <tr> </tr> <?php } ?> </table> </td> </tr> </table> <?php $kontakt->close(); ?> </body> </html>
Jeżeli jest to jakaś prosta sprawa to proszę o wyrozumiałość, jestem bardzo początkujący
