Jump to content

[SOLVED] I messed up the code :(


Gem

Recommended Posts

Ummm ... please would someone take a look at this... I think I messed it up...

<?php
// assumes all the data for the current year is to be retrieved
$con = mysql_connect("80.94.196.33","gem","landseer");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
}
mysql_select_db("bssql", $con);

$result = mysql_query(
"select *,MONTHNAME(date) as mn from diary 
where year(date) = year(curdate()) order by date");

$previous_month = ""; // initialize variable to detect change in month name
while($row = mysql_fetch_array($result))
{
if($row['mn'] != $previous_month){
	?><H1><?php echo $row['mn'] . '<br />'; ?> </H1> <?php
	$previous_month = $row['mn'];
}
  ?><H2><?php echo nl2br($row['event']); ?> </H2>
    <H3><?php $date = explode("-",$row['date']);
              $date = date("jS F Y",mktime(0,0,0,$date[1],$date[2],$date[0]));
              echo nl2br '.$date.'; ?> </H3>
        <?php echo nl2br($row['details']);
              echo "<br />##########################################";
              echo "<br /><br />";
}



?>

 

Error: PHP Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in d:\webspace\bradleystokejudoclub.co.uk\wwwroot\diary.php on line 171

 

Line 171 is: echo nl2br '.$date.'; ?> </H3> (supposidly!)

 

Any ideas what I've done, or more importantly ... how I fix it???

 

Thanks a million ... x

 

Link to comment
https://forums.phpfreaks.com/topic/149452-solved-i-messed-up-the-code/
Share on other sites

LOL - Thanks mate.

 

Only works if I do this: echo nl2br($date); ?> </H3>

 

I'm very new to this game (like I only started a week ago!) I'm learning as I'm doing ...

 

I don't really know what I'm doing at all LOL

 

Thanks for your help though ...

 

Is there anywhere with DO/DON'Ts on formatting code???

 

XXXXX

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.