All pastes #930162 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-03-06 10:21 UTC
rendered paste body
<?php
function get10last()
	$pdo = new PDO('mysql:host="<host til database>;dbname=<navnet på database>', '<brukernavn>', '<passord>');
	try {
			$this->getconnection();
			$array = array();
			$stmt = $this->pdo->prepare("select setning her");
			if ($stmt->execute()) {
				while($row = $stmt->fetch()) {
					$array[] = $row;
				}
			}
			$this->pdo = null;
			return $array;
		}
		catch (Exception $e) {
			$this->error[] = $e->getMessage();
		}
?>