query("select posted, title, text from entry"); foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) { $date = $row["posted"]; $title = $row["title"]; $text = $row["text"]; $tags = array(); /* no tags yet.. */ $entries[] = array("title" => $title, "date" => $date, "text" => $text, "tags" => $tags); } return $entries; } function newconn() { if (gethostname() === "cgi-vm.cs.arizona.edu") { $dbname = "whm_cs337f13"; $user = "cs337f13"; $pw = "tednelson"; $host = "mysql.cs.arizona.edu"; } else { $dbname = "blog"; $user = "root"; $pw = ""; $host = "127.0.0.1"; } $dsn = "mysql:host=$host;dbname=$dbname"; // Data source name $conn = new PDO($dsn, $user, $pw); return $conn; }