Cały czas dostaje komunikat o błędnym\nieznanym linku do bazy.
Skrypt wyglada tak:
<?php
/*
DB connector by Jakub Mróz (www.webArts.pl)
Class responsible for database connections
release 03.09.v1b
*/
class dbconn {
protected $link;
private $server, $username, $password, $db;
public function __contruct($server, $username, $password, $db)
{
$this->server = $server;
$this->username = $username;
$this->password = $password;
$this->db = $db;
$this->connect();
}
public function __destruct()
{
mysql_close($this->link);
}
/* Database connect function */
private function connect()
{
$this->link = mysql_connect($this->server, $this->username, $this->password);
mysql_select_db($this->db, $this->link);
}
/*
Simple SQL Fetcher
Returns: sql execution result
*/
public function execute($sql)
{
$this->connect();
return mysql_query($sql, $this->link);
}
/* Registrations of a new patient */
public function regPatient($firstname, $surname, $weight, $pesel)
{
// jacob's Simple Anty-hack tool

$firstname=addslashes($firstname);
$secondname=addslashes($secondname);
# Must be . in float
$weight = (float)str_replace(",",".",$weight);
//if ( (($weight>=0.100) && ($weight<=500.000)) && !empty($firstname) && !empty($surname) && (strlen($pesel)==11) )
//{
return $this->execute("INSERT INTO patient(firstname, surname, weight, pesel) VALUES('$firstname','$secondname',".(float)$weight.", ".(int)$pesel.")");
//} else {
//return 'err';
//}
}
}
?>
co jest nie tak?