<?php /* * Created on May 11, 2007 * by Jim Cassata * To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */ include("./podz.inc"); // Create new service for AMFPHP Remoting as Class class megapod { var $mysqli; function megapod() { # Connect to MySQL database.... $this->mysqli = new mysqli(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME); # Check MySQL connection if (mysqli_connect_errno()) { # Dont use die (Fatal Error), return useful info to the client trigger_error("AMFPHP Remoting 'sample' class could not connect: " . mysqli_connect_error()); } } function getPodz() { $query = "SELECT * FROM podz WHERE pid > 100 ORDER BY podName"; if (!$result=@$this->mysqli->query($query)) { $errno=$this->mysqli->errno; $this->mysqli->close(); trigger_error("AMFPHP Remoting database SELECT query [$query] error: " . $errno); } while ($row = $result->fetch_assoc()) { $return_array[] = $row; } return($return_array); } function getCats() { $query = "SELECT categoryName,categoryID FROM categories ORDER BY categoryName"; if (!$result=@$this->mysqli->query($query)) { $errno=$this->mysqli->errno; $this->mysqli->close(); trigger_error("AMFPHP Remoting database SELECT query error: " . $errno); } while ($row = $result->fetch_assoc()) { $return_array[] = $row; } return($return_array); } function searchPodz($data) { $query = "SELECT * FROM podz WHERE podName like '%$data%' OR podDescription like '%$data%' OR podMetaData like '%$data%' AND pid > 100 ORDER BY podName"; if (!$result=@$this->mysqli->query($query)) { $errno=$this->mysqli->errno; $this->mysqli->close(); trigger_error("AMFPHP Remoting database SELECT query error: " . $errno); } while ($row = $result->fetch_assoc()) { $return_array[] = $row; } return($return_array); } } ?>