open();
}
function open()
{
if ( !$this->connect )
{
$this->connect = new mysqli( $this->server, $this->user, $this->passwd, $this->database );
if ( $this->connect->connect_errno )
{
log_error( "Échec de la connexion : => " . $this->connect->connect_error . "
" . __file__ . ' ligne ' . __line__);
return false;
}
}
$this->connect->set_charset("utf8");
return true;
}
function close()
{
$this->connect->close();
$this->connect = 0;
}
function protect( $string )
{
return $this->connect->real_escape_string( $string );
}
function query( $string )
{
//log_write( $string );
if ( empty( $this->connect ) ) $this->open();
$this->result = $this->connect->query( $string ) ;
if ( $this->connect->error ) log_error( "Échec de la commande query => " . $this->connect->error . "
" . __file__ . ' ligne ' . __line__ . "\n" . $string, true, true);
//print_r( $this );
}
function print_error()
{
print_r( $this );
//$this->error = $this->error;
return $this->connect->error;
}
function newPlane()
{
$query = "INSERT INTO avionpoeme SET (";
$query .= $this->message . ", ";
$query .= $this->expeMail . ", ";
$query .= $this->expeKnown . ", ";
$query .= $this->expeLang . ", ";
$query .= $this->destLang . ", ";
$query .= $this->startLat . ", ";
$query .= $this->startLon . ", ";
$query .= $this->startName . ", ";
$query .= $this->startTime . ", ";
$query .= $this->StartTZ . ", ";
$query .= $this->destMail . ", ";
$query .= $this->destLat . ", ";
$query .= $this->destLon . ", ";
$query .= $this->destName . ", ";
$query .= $this->status . ", ";
$query .= $this->color . ", ";
$query .= $this->actual_lat . ", ";
$query .= $this->actual_lon . ", ";
$query .= $this->bearing . ", ";
$query .= $this->deliveryTime . ", ";
$query .= $this->deliveryTZ . ", ";
$query .= $this->deliveryTimeServer . ", ";
$query .= ")";
}
}
?>