alemapo Posted August 28, 2009 Share Posted August 28, 2009 I had this code working great and then took out one of the "else" because I didn't need it anymore. Now I can't get the } right at the end. I keep getting this error. Parse error: syntax error, unexpected $end in /home6/carroll7/public_html/upload_functions_magick.php on line 45 Then if I move it I get another. Can anyone see it right off? Many thanks in advance. if (isset($_POST['submitted'])) { $image_type = upload_image(); //check to see if image type returned ok if ($image_type == 'ok') { //call move image function $full_path = "/home6/carroll7/public_html/classified_images/"; $short_path = "/classified_images/"; $stored_name = move_image($full_path, $short_path); $_POST['hiddenField'] = $stored_name; echo "Image upload success!"; } else { echo "image wrong type"; } } Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 Looks like you have a floating } at the end there, need to show us more code so we can see where the issue is. Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 That portion looks valid to me. Can we see more of the surrounding code? Are there more conditions before? Quote Link to comment Share on other sites More sharing options...
alemapo Posted August 28, 2009 Author Share Posted August 28, 2009 The surrounding code is all dreamweaver created. To the best of my knowledge I didn't change any of that. My code was working before but I had another level else in there that was removed. <?php require_once('Connections/Carrollton.php'); ?> <?php include('upload_functions_magick.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } //call upload image function if (isset($_POST['submitted'])) { $image_type = upload_image(); //check to see if image type returned ok if ($image_type == 'ok') { //call move image function $full_path = "/home6/carroll7/public_html/classified_images/"; $short_path = "/classified_images/"; $stored_name = move_image($full_path, $short_path); $_POST['hiddenField'] = $stored_name; echo "Image upload success!"; } else { echo "image wrong type"; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } Quote Link to comment Share on other sites More sharing options...
Maq Posted August 28, 2009 Share Posted August 28, 2009 Why do you have an if statement around a function? Please use tags. Quote Link to comment Share on other sites More sharing options...
ReKoNiZe Posted August 28, 2009 Share Posted August 28, 2009 The function in the if statement is a little odd... Try changing echo "Image upload success!"; } to: echo "Image upload success!"; } Do that with the else statement too, putting curly brackets on their own line is good practice and makes things easier to read and find the beginning/end of an if statement. Quote Link to comment 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.