I’m no PHP expert, but I believe the problem with this script is using it with PHP 5, but I really can’t tell. Please help.
[code]<?php
Define(‘DATABASE_SERVER’, ‘12.34.56.789’);
Define(‘DATABASE_USERNAME’, ‘myName’);
Define(‘DATABASE_PASSWORD’, ‘myPassword’);
Define(‘DATABASE_NAME’, ‘myDB’);
class AppointmentsService {
private $mysqli;
private $err_prefix="Remoting Error: ‘myService’ class database ";
public function __construct() {
error_reporting(0); # Silence error messages and return them to WebORB
# Connect to MySQL database....
$this->mysqli = new mysqli(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME);
if (mysqli_connect_errno()) {
$msg=$this->err_prefix."could not connect: ".mysqli_connect_error();
throw new Exception($msg);
}
}
public function getData($year, $month) {
if (!$result=$this->mysqli->query("SELECT * from myData WHERE year='$year' AND month='$month'")) {
$msg=$this->err_prefix."SELECT query error: ".$this->mysqli->error;
$this->mysqli->close();
throw new Exception($msg);
}
while ($row = $result->fetch_assoc()) {
$search_array[] = $row;
}
return($search_array);
}
}
?>[/code]
MOD EDIT: Added code tags.