Ok, to podsumowując:
klasy uzywam takiej:
<?php
class db {
var $dbname;
var $connection;
var $result;
function db($user, $dbname, $host, $password, $port){
$this-> connection
= pg_connect($user,$dbname,$host,$password,$port); }
function query($query){
$this-> query = $query;
$this-> result
= pg_exec($this->connection, $this->query);
if (!$this->result) {
}
}
function close(){
}
}
?>
W pliku używam jej tak:
<?php
include('klasa.php');
if($_POST['skrypt'] == 'dodajf'){
$db = new db('romek', 'romek', 'xxxx.xx.xxx', 'xxxxxxxxxxx', '54321');
$db -> query("insert into w_filmy (nazwa_oryg, nazwa_pl, gatunek, czas, nosnik, rok_prod, kraj, od_lat, premie
ra, status) values('".$_POST['nazwa_oryg']."','".$_POST['nazwa_pl']."','".$_POST['gatunek']."','".$_POST['czas']."','".$_POST['nosnik']."','".$_POST['rok_prod']."','".$_POST['kraj']."','".$_POST['od_lat']."','".$_POST['premiera']."','0'");
$db -> result;// = pg_exec($query);
$db-> close();
};
?>
Po próbie dodanie jakieś rekordu, mam komunikat:
<?php
Warning
: pg_connect() [function.pg
-connect
]: Unable to connect to PostgreSQL server
: could not translate host name
"romek" to address
: Name or service not known in
/home
/informatyka
/public_html
/klasa
.php on line 9
Warning
: pg_exec(): supplied argument is not a valid PostgreSQL
link resource in
/home
/informatyka
/public_html
/klasa
.php on line
14blad
?>
Już nie wiem co jest źle