xanie Posted January 10, 2013 Share Posted January 10, 2013 $event_date = date('Y-m-d', strtotime($event_date)); Any suggestion guys??tnx.. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/ Share on other sites More sharing options...
Dharmender Posted January 10, 2013 Share Posted January 10, 2013 $event_date = date('Y-m-d', strtotime($event_date)); Any suggestion guys??tnx.. From where the value of $event_date is coming. Is it on form submit Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404613 Share on other sites More sharing options...
Muddy_Funster Posted January 10, 2013 Share Posted January 10, 2013 the issue is most likely in the code previous to that line. show 10-15 lines either way of your actual code, posted inside code or php tags, and we'll see Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404616 Share on other sites More sharing options...
Ninjakreborn Posted January 10, 2013 Share Posted January 10, 2013 There are no "Syntax" errors with the code that you pasted. Most likely the error is somewhere else in the file. Please copy/paste all relevant code, and we can review and see if there are any obvious errors in the code. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404701 Share on other sites More sharing options...
xanie Posted January 11, 2013 Author Share Posted January 11, 2013 here is the full code.. tnx <?php if(isset($_POST['submit'])) { $event_name = $_POST['event_name']; $event_details = $_POST['details']; $event_date = $_POST['date_from']; $event_image = $_POST['event_image']; if(!empty($_FILES['event_image']['name'])) { $fileName = $_FILES['event_image']['name']; $tmpName = $_FILES['event_image']['tmp_name']; $fileSize = $_FILES['event_image']['size']; $fileType = $_FILES['event_image']['type']; $fp = fopen($tmpName, 'r'); $content = fread($fp, filesize($tmpName)); $content = addslashes($content); fclose($fp); if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); } } else { $content = "NULL"; $fileName = "NULL"; $fileType = "NULL"; } cdv $event_date = date('M d, Y', strtotime($event_date)); // outputs 2006-01-24 mysql_query("INSERT INTO events (event_name, event_details, event_date, photo, photo_name, photo_file_type) VALUES('$event_name', '$event_details', '$event_date', '$content', '$fileName', '$fileType') ") or die(mysql_error()); echo "<span class='approved_msg'>Your New Event Has Been Posted.</span>"; header("refresh: 2; url=../index.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404833 Share on other sites More sharing options...
haku Posted January 11, 2013 Share Posted January 11, 2013 cdv There's your problem. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404842 Share on other sites More sharing options...
xanie Posted January 11, 2013 Author Share Posted January 11, 2013 i've already remove that "cdv" while executing the code.. still the error appears like that.. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404877 Share on other sites More sharing options...
xanie Posted January 11, 2013 Author Share Posted January 11, 2013 i've already remove that "cdv" while executing the code.. still the error appears like that.. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404880 Share on other sites More sharing options...
Christian F. Posted January 11, 2013 Share Posted January 11, 2013 Post your updated code. Quote Link to comment https://forums.phpfreaks.com/topic/272935-parse-errorsyntax-errorunexpected-event_date-t_variable/#findComment-1404884 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.