Created
November 26, 2011 04:52
-
-
Save iaindooley/1395043 to your computer and use it in GitHub Desktop.
Spaghetti Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getPageTitle() | |
{ | |
return mysql_result('SELECT title FROM data',0,'title'); | |
} | |
?> | |
<html> | |
<head> | |
<title><?php echo htmlentities(getPageTitle()); ?></title> | |
</head> | |
<body> | |
<?php if($_GET['some_parameter']) { ?> | |
<ul> | |
<?php | |
mysql_connect('localhost','user','pass'); | |
mysql_select_db('database'); | |
$query = mysql_query('SELECT * FROM table'); | |
while($row = mysql_fetch_assoc($query)) | |
{ | |
?> | |
<li><?php echo htmlentities($row['some_field']); ?></li> | |
<?php } ?> | |
</ul> | |
<?php } ?> | |
</body> | |
</html> |
Haha totally :)
I don't think that this will work...
Calling getPageTitle (and mysql_result) before connecting to the database :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Perhaps this proves your point: You are missing a
?>
in the title-tag ...