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>
Prevention Help
How can I use PHP or any other language (feel free to move this thread) to prevent users doing screenshots of the website (maybe Java??) so if anyone knows how I can achieve this please post. Or how
PHP5 - AJAX help
I've been following the tutorial on w2schools (http://www.w3schools.com/php/php_ajax_database.asp) about using AJAX and a database. It's my first time actually using AJAX and I've run into a problem.
Change snippet to use CURDATE
I am using time() in the snippet below, I would like to use CURDATE() and have the database setup for date. My problem is, I am not sure how to change the PHP coding, I keep getting errors just adding
Error in Configure System Landscape Directory phase
Hi
Simultaneous select/update/insert
HiHow would I need to go about when 2 users update a single row simultaneous? And how would I need to go about when 2 users want to edit a row?Should I first lock the table, update the row to indicate
problems with php variables in mysql query
i can't seem to get the following query to work. select $q1c from $vote_rate where id = $recent_record LIMIT 0,1 ;this method did not work eitherselect .$q1c. from .$vote_rare. where id =
Reg Ex
Im trying to search for the string: srv_9 (Dead ???)I thought to use preg_match, however I dont know much about reg ex. Can anyone help? Thankks
MySQL Does not UPDATE- SQLString Problem
vb Syntax (Toggle Plain Text)
Problems with array
This code is the last lines in an upload script that uploads 4 images at the same time and writes the url to these and som other information to the database. database structure: id img1 img2 img3
Timer control causing error
I recently decided to add a timer control to an existing page that uses AJAX on my site. As soon as I added the timer control and ran my app, I started getting the following error:Description: An