You need to pass a title"; exit; } $host = 'localhost'; $user = 'nobody'; $pass = ''; // SQL stolen from shared-manual.inc:manualGetUserNotes() if ( $title == "all" ) $query = "SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note ORDER BY id"; else $query = "SELECT *,UNIX_TIMESTAMP(ts) AS xwhen FROM note WHERE sect = '$title' ORDER BY id"; // is there a more efficient way to do this? $notes = array(); $db_id = mysql_connect($host, $user, $pass); $result_id = mysql_db_query("php3", $query, $db_id); if ($result_id && mysql_num_rows($result_id) > 0) { while ($row = mysql_fetch_array($result_id,MYSQL_ASSOC)) { $notes[$row["sect"]][] = $row; } } echo serialize( $notes ); } else { // retreive ALL notes from www.php.net // break up into sections and save to usernotes/ echo ""; } ?>