Location: PHPKode > projects > HypatiaDB > hypatiadb/saved-reports.php
<?php
include("common_db.php");
include("functions.php");
dbconnect($host, $username, $password); //from common_db.php
$strings = loadStrings($lang, 'SREPORT');

if(isset($_REQUEST['report_id'])) {
	$new_report_id = intval($_REQUEST['report_id']);
	//If we get to here, then the user has chose to create a new report.
	$report_title = mysql_real_escape_string($_REQUEST['title']);
	if($_REQUEST['ct'] == 'column') {
		$report_type = 'columnar';
	} else {
		$report_type = 'tabular';
	}

	//update details appropriately
	mysql_select_db('HypatiaDB');
	$query = "UPDATE reports SET style = '$report_type', title = '$report_title', temp = 0 WHERE id = '$new_report_id'";
	mysql_query($query) or die(mysql_error());		//TODO: L10n
}

headers();
html();
head($strings['SR_TITLE']);
menu();
navpane();
?>
	<div id="mainpane">
		<?php
		mysql_select_db('HypatiaDB');
		$query = "SELECT id,title FROM reports WHERE temp = 0";
		($reports = mysql_query($query)) or die(mysql_error());
		if(mysql_num_rows($reports) == 0) {
			echo("<p>$strings[SR_NOREPORTS]</p>");
		} else {
			echo('<ul>');
			while($report = mysql_fetch_array($reports)) {
				echo('<li><a href="view-report.php?id=' . $report['id'] . '">' . $report['title'] . '</a></li>');
			}
			echo('</ul>');
		}
		?>
	</div>
<?php
endhtml();
?>
Return current item: HypatiaDB