jmfillman Posted February 22, 2008 Share Posted February 22, 2008 I am a PHP newbie, but I believe this is not working because of PHP 5, was working on PHP 4 ???. Also, if this could be cleaned up or improved, I really would appreciate any help you can offer. <?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); } } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.