Skip to main content

Graph 2

<?PHP
	session_start();
#	header("Content-type: image/gif");
	header("Content-type: image/jpeg");
	$image = imagecreate(200, 200);
#	imagegif($image);
	imagejpeg($image);

?>
/*
<html>
<head>
<title>
	Example MySQL query
</title>

<body>

<form method="post" action=<?PHP print $PHP_SELF ?> >
	<?PHP
		print "Session: " . session_id() . "<p>\n";

		$owner = "Pdit8unx0";
		$table = "phones";
		$field_to_search = "names";
		$fields = array(id, names, number);

		$owner = "Pded0phs";
		$table = "phone";
		$field_to_search = "name";
		$fields = array(id, name, number);

		print "Looking for a name like \"$name\"<p>\n";
		$connect = mysql_connect("mysql.dur.ac.uk", "nobody", "");


		$query = "select * from " . $table ;
		$query = "select * from " . $table . " where " . $field_to_search . " like \"%$name%\"";
		$db = "directory";
		$database = $owner . "_" . $db;
//		$database = "Pdit8unx0_directory";
		$query_result = mysql_db_query($database , $query );

		$numfields = mysql_num_fields($query_result);
		print $numfields . " fields:<br><br>";

		$numrows = mysql_num_rows($query_result);
		print $numrows . " rows found:<br><br>";
		print "<table>";
		for ($r = 0 ; $r < $numrows  ; $r++) {
			print "<tr><td></td>\n";
			for ($f = 0 ; $f < $numfields ; $f++) {
				print "<td bgcolor=\"yellow\">";
				print mysql_result($query_result, $r, "$fields[$f]");
				print "</td>";
			}
			print "</tr>\n";
		}
		print "</table><br>";
	
		print "Try another name:";
		print "<br><br>";
		print "<input type=\"text\" name=\"name\" value=\"$name\"></input>";
	?>
	<input type="submit" value="Search for name"  bgcolor="yellow"></input>
</form>
</body>
</head>
</html>
*/