I found some sample code I would like to use but it said I might need to change it for php4. I ran it and sure enough it does not work. What would I need to change for this to work?
<?
class SortableExample {
protected $conn;
protected $user = 'test';
protected $pass = 'test';
protected $dbname = 'scriptaculous';
protected $host = 'localhost';
public function __construct() {
$this->conn = mysql_connect($this->host, $this->user, $this->pass);
mysql_select_db($this->dbname,$this->conn);
}
public function getList() {
$sql = "SELECT * FROM categories ORDER BY orderid";
$recordSet = mysql_query($sql,$this->conn);
$results = array();
while($row = mysql_fetch_assoc($recordSet)) {
$results[] = $row;
}
return $results;
}
public function updateList($orderArray) {
$orderid = 1;
foreach($orderArray as $catid) {
$catid = (int) $catid;
$sql = "UPDATE categories SET orderid={$orderid} WHERE catid={$catid}";
$recordSet = mysql_query($sql,$this->conn);
$orderid++;
}
}
}
?>
Thanks,
Travis