I got this error:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\AddMessage.php on line 83
and I don't know what I'm doing wrong. Here's my code:
<?php
mysql_connect("localhost", "root", "") or die (mysql_error ());
mysql_select_db("tHofbrouwerijke") or die(mysql_error());
$name = $_FILES["ImgBericht"]["name"];
$newnameBericht = "ImgBericht_" . $name;
$type = $_FILES["ImgBericht"]["type"];
$size = $_FILES["ImgBericht"]["size"];
$temp = $_FILES["ImgBericht"]["tmp_name"];
$error = $_FILES["ImgBericht"]["error"];
move_uploaded_file($temp,"Uploaded/".$newnameBericht);
echo $newnameBericht;
$strSQL = "INSERT INTO nieuws(Naam, Message, date,NaamAfbBericht) VALUES('".$_POST['Titel']."','".$_POST['Bericht']."','".date('Y-m-d H:i:s')."','".$newnameBericht."')";
mysql_query($strSQL) or die(mysql_error());
$ourFileName = $_POST['Titel'].".php";
$NewMessageFile = fopen($ourFileName, 'w') or die("can't open file");
$NewHTML =
"<html>
<head>
<title>
t Hofbrouwerijke
</title>
<link rel='stylesheet' type='text/css' href='style/style.css' />
<script type='text/javascript' src='Js/LatestJQuery.js'></script>
<script type='text/javascript' src='Js/JScript.js'></script>
</head>
<body>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = '//connect.facebook.net/nl_NL/all.js#xfbml=1';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<h1>'t Hofbrouwerijke </h1>
<h2> Bericht </h2>
<ul class='outerlist'>
<li><a href='Default.php'>Home </a></li>
<li><a href='Ontstaan.php'>Ontstaan </a></li>
<li><a href='#'>Winkel</a>
<div id ='winkel'>
<ul class='innerlist'>
<li><a href='Bieren.php'> Bieren </a></li>
<li><a href='Geschenkverpakkingen.html'> Geschenkverpakkingen </a></li>
<li><a href='Merchandise.html'> Merchandise </a></li>
</ul>
</div>
</li>
<li><a href='#'>Verkooppunten</a>
<div id='verkooppunten'>
<ul class='innerlist'>
<li><a href='Cafes.php'> Cafés </a></li>
<li><a href='Drankenhandelaars.php'> Drankenhandelaars </a></li>
</ul>
</div>
</li>
<li><a href='EigenKweek.php'>Eéndagsbrouwer </a></li>
<li><a href='Contact.html'>Contact </a></li>
<li><div class='fb-like' data-href='https://www.facebook.com/pages/t-Hofbrouwerijke/173136023627?fref=ts' data-width='240px' data-layout='standard' data-action='like' data-show-faces='true' data-share='true'></div><br></li>
</ul>
<p>
<table border='1'>
<tr><td>
<table border='1' class='image'>
<tr><td>
<img class='nieuws' src=\"Uploaded/".$newnameBericht."\" width=\"150px\">
</td></tr>
</table>
</td>
<td>
<table border='1' class='news'>
<?php
mysql_connect('localhost', 'root', '') or die (mysql_error ());
mysql_select_db('thofbrouwerijke') or die(mysql_error());
$strSQL = 'SELECT * FROM nieuws WHERE Naam=\"".$_POST['Bericht']."\"';
$rs = mysql_query($strSQL);
while($row = mysql_fetch_array($rs)) {
echo '<tr><td><span class=\"titel\">'. $row['Naam']. '<br /></span></td></tr>';
echo '<tr><td><div class =\"message\">'.$row['Message'] . '</div><br /></td></tr>';
echo '<tr><td><span class=\"datum\"> gepost op '.$row['date'].'</span></td></tr></td>';}
?>
</table>
</td></tr>
</table>
</p>
</body>
</html>";
fwrite($NewMessageFile, $NewHTML);
fclose($NewMessageFile);
header('Location: ModNieuws.php');
?>
use
mysql_error()
notmysql_error ()
and u are using php tags inside
<<html
.its not a good practice. dont append it to the html.append the formed table to the current using html variable.