Probably a simple error...


Posted on 16th Feb 2014 07:03 pm by admin

I'm getting the error -- Parse error: syntax error, unexpected '{' in /home/content/c/s/t/csteffen242/html/staples/event.php on line 46

I checked it over and couldn't find anything wrong with an extra bracket, but I could easily be missing something simple

Code: <html>
<head>
<title>Show/Add Events</title>
</head>
<body>
<h1>Show/Add Events</h1>
<?php
$mysqli = mysqli_connect ---

//add new event
if ($_POST) {
$m = $_POST["m"];
$d = $_POST["d"];
$y = $_POST["y"];

$event_date = $y."-".$m."-".$d." ".$_POST["event_time_hh"].":
".$_POST["event_time_mm"].":00";
$insEvent_sql = "INSERT INTO calendar_events (event_title, event_shortdesc, event_start) VALUES ('".$_POST["event_title"]."', '".$_POST["event_shortdesc"]."', '$event_date')";
$insEvent_res = mysqli_query($mysqli, $insEvent_sql) or die(mysqli_error($mysqli));
} else {
$m = $_GET["m"];
$d = $_GET["d"];
$y = $_GET["y"];
}

//show events
$getEvent_sql = "SELECT event_title, event_shortdesc, date_format(event_start, '%1:%i %p') as fmt_date FROM calendar_events WHERE month(event_start) = '".$m."' AND dayofmonth(event_start) = '".$d."' AND year(event_start)= '".$y."' ORDER BY event_start";
$getEvent_res = mysqli_query($mysqli, $getEvent_sql) or die(mysqli_error($mysqli));

if (mysqli_num_rows($getEvent_res) > 0) {
$event_txt = "<ul>";
while ($ev = @mysqli_fetch_array($getEvent_res)) {
$event_title = stripslashes($ev["event_title"]);
$fmt_date = $ev["fmt_date"];
$event_txt .= "<li><strong>".$fmt_date."</strong>:
".$event_title."</br>".$event_shortdesc."</li>";
}
$event_txt .= "</ul>";
mysqli_free_result($getEvent_res);
} else {
$event_txt = "";
}
mysqli_close($mysqli);

if ($event_txt != "" {
echo "<p><strong>Today's Events:</strong></p>
$event_txt
<hr/>";
}

//show form
echo "
<form method="post" action="".$_SERVER["PHP_SELF"]."">
<p><strong>Would you like to add an event?</strong><br/>
Complete the form below and press the submit button to add an event</p>
<p><strong>Event Title:</strong><br/>
<input type="text" name="event_title" size="25" maxlength="25" />
<p><strong>Event Title:</strong><br/>
<input type="text" name="event_shortdesc" size="25" maxlength="255" />
<p><strong>Event Time (hh:mm):</strong><br/>
<select name="event_time_hh">";
for ($x=1; $x <= 24; $x++) {echo "<option value="$x">$x</option>";
}
echo "</select> :

<select name="event_time_mm">
<option value="00">00</option>
<option value="00">15</option>
<option value="00">30</option>
<option value="00">45</option>
</select>
<input type="hidden" name="m" value="".$m."">
<input type="hidden" name="d" value="".$d."">
<input type="hidden" name="y" value="".$y."">
<br/><br/>
<input type="submit" name="submit" value="Add Event">
</form>";
?>
</body>
</html>

No comments posted yet

Your Answer:

Login to answer
283 Like 41 Dislike
Previous forums Next forums
Other forums

DATEDIFF Question
First time post, and of course it is a help question.

I am using a WP plug-in to display prev

Good Programming and Web Design Books
Hi,

I recived a pm today from a fellow phpfreaker regarding php books, i replied with the fo

need help in mysql_num_rows()
please tell me what i am doing wrong in this query. it displays this error

Code: Warning: mys

System copy error in RUN ABAP REPORT PHASE
Hi,
I am performing system copy on my test server. I have previously taken export of JAVA + A

Async WSAConnect failed on XP with error code = 2 ("File not found")
Hi all,

I have very strange bug, please help me if you can.

It is reproduced o

Limiting uploaded file type
I am working on a simple upload script, and I need it to limit the allowed file type that is uploade

Help With editting and deleting form
Hallo !!

So look at this image :

http://img194.imageshack.us/img194/8272/snapshot5f.pn

How to make a input/output field with multiple lines
Hello.
I put a input/output field on the screen but I could not change height of it. I need to

Weird Problem with curl while sending data
I am facing a weird problem with sending data to a site via curl.

If i send the value by this

Problem Dereferencing
With these types and tables:

CREATE TYPE MANAGER AS OBJECT (
MGR_ID INTEGER,

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash