Call to a member function on a non-objec
PLIK PHP-------------->
<?php
$nazwa_uz=$_POST['nazwa_uz'];
$haslo=$_POST['haslo'];
$adres=$_POST['adres'];
$nazwa_wyswietl=$_POST['nazwa_wyswietl'];
if (!$nazwa_uz || !$haslo || !$adres || !$nazwa_wyswietl)
{
echo 'Nie podano wszystkich potrzebnych danych.<br />'
.'Wróć do poprzedniej strony i spróbuj ponownie.';
exit;
}
if (!get_magic_quotes_gpc())
{
$nazwa_uz = addslashes($nazwa_uz);
$haslo = addslashes($haslo);
$adres = addslashes($adres);
$nazwa_wyswietl = addslashes($nazwa_wyswietl);
}
function connection() {
// serwer
$mysql_server = "https://sql.zss.nazwa.pl";
// admin
$mysql_admin = "ert_1";
// hasło
$mysql_pass = "sirtan";
// nazwa baza
$mysql_db = "ztre_1";
// nawiązujemy połączenie z serwerem MySQL
@mysql_connect($mysql_server, $mysql_admin, $mysql_pass)
or die('Brak połączenia z serwerem MySQL.');
// łączymy się z bazą danych
@mysql_select_db($mysql_db)
or die('Błąd wyboru bazy danych.');
}
$zapytanie = "insert into uzytkownicy values ('".$nazwa_uz."', '".$haslo."', '".$adres."', '".$nazwa_wyswietl."')";
$wynik = $db->query($zapytanie);
if ($wynik)
echo $db->affected_rows.'Zarejestrowany';
?>
-----------> baza
create table uzytkownicy
(
nazwa_uz char(16) not null primary key,
haslo char(40) not null,
adres char(100) not null,
nazwa_wyswietl char(100) not null
);
create table konta
(
nazwa_uz char(16) not null,
serwer char(100) not null,
port int not null,
typ char(4) not null,
zdalny_uzyt char(50) not null,
zdalne_haslo char(50) not null,
id_konta int unsigned not null auto_increment primary key
);