File: php1.php

package info (click to toggle)
ohcount 3.0.0-6.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 4,828 kB
  • sloc: ansic: 6,534; ruby: 2,560; perl: 2,041; erlang: 350; lisp: 272; sh: 244; pascal: 196; vhdl: 150; haskell: 149; asm: 127; cs: 124; awk: 98; java: 92; php: 73; tcl: 58; xml: 57; fortran: 54; makefile: 32; python: 31; ada: 30; objc: 30; jsp: 28; sql: 18; cobol: 13; ml: 9; cpp: 3
file content (59 lines) | stat: -rw-r--r-- 1,208 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
                      "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<script type="text/javascript">
		// javascript comment
		document.write("Hello World!")
		</script>
		<style type="text/css">
		/* css comment */
		h1 {
			color: black;
		}
		</style>
	</head>
	<body>
	<table cellSpacing=1 cellPadding=2 bgColor=black border=0>
	<tr bgColor=white>
	<td>First</td>
	<td>Last</td>
	<td>Email<td>
	</tr>
	</table>

<?
## Comment with a hash symbol ##
	mysql_connect("localhost", "db user", "db pass")
	or die("DB CONNECT ERROR: " . mysql_error());

	mysql_select_db("db name")
	or die("DB SELECT ERROR: " . mysql_error());

	$query = "SELECT fname, lname, email FROM table ORDER BY lname";

	$result = mysql_query($query)
	or die("DB SELECT ERROR: " . mysql_error());

	while($row = mysql_fetch_array($result))
	{
		$lname = $row['lname'];
		$fname = $row['fname'];
		$email = $row['email'];

		// Spaghetti code starts....(slopping html code in)
?>

	<tr bgColor=white>
	<td><?=$fname?></td>
	<td><?=$lname?></td>
	<td><?=$email?><td>
	</tr>
	</table>

<?
	} // end while
	// Spaghetti code is both a source of praise and complaints
?>

</body>