hellonoko Posted December 17, 2008 Share Posted December 17, 2008 I'm sure this is something simple I am just not seeing but I can't find it. What am I missing here? Parse error: syntax error, unexpected ';' in /home2/sharingi/public_html/emocowgirl/admin/ideas.php on line 23 Line 23 is: $result = mysql_query("SELECT * FROM IDEAS WHERE ID = '$ideatoedit'"); <?php //////////////////////////////////////////////// /////////////////////////////////////////////// $username = "sharingi_emo"; $password = "emo"; $hostname = "localhost"; $db_connect = mysql_connect( $hostname , $username, $password) or die ("Unable to connect to database"); mysql_select_db( "sharingi_emocowgirl" , $db_connect); ///////////////////////////////////////////////// //////////////////////////////////////////////// $action = $HTTP_GET_VARS['action']; $ideatoedit = intval($HTTP_GET_VARS['item']); if ( $action == "edit") ( $result = mysql_query("SELECT * FROM IDEAS WHERE ID = '$ideatoedit'"); while ($row = mysql_fetch_row($result)) { } echo '<form action="ideas.php" method="get" name="ideas" id="ideas">'; echo '<label>'; echo '<textarea name="idea" id="idea" cols="45" rows="5">'.$row['idea'].'</textarea>'; echo '</label>'; echo '<label>'; echo '<textarea name="image" id="image" cols="45" rows="5">'.$row['image'].'</textarea>'; echo '</label>'; echo '<label> <br>'; echo '<input type="submit" name="update" id="update" value="Update...">'; echo '</label></form>'; ) else ( echo '<form action="ideas.php" method="get" name="ideas" id="ideas">'; echo '<label>'; echo '<textarea name="idea" id="idea" cols="45" rows="5"></textarea>'; echo '</label>'; echo '<label>'; echo '<textarea name="image" id="image" cols="45" rows="5"></textarea>'; echo '</label>'; echo '<label> <br>'; echo '<input type="submit" name="add" id="add" value="It Hurts...">'; echo '</label></form>'; ) ?> <?php $idea = $HTTP_GET_VARS['idea']; $image = $HTTP_GET_VARS['image']; if ($idea != "") { $query = mysql_query("SELECT * FROM ideas WHERE idea = '$idea'"); $rows = mysql_num_rows($query); if ( $rows == 0 ) { mysql_query("INSERT INTO ideas ( IDEA, IMAGE ) VALUES ( '$idea' , '$image' )") or die (mysql_error()); } } ///display everything $result = mysql_query("SELECT * FROM ideas"); while ($row = mysql_fetch_assoc($result)) { echo '<a href="ideas.php?action=edit&item='.$row['id'].'"><img src="http://www.emocowgirl.com/images/pencil.png" alt="Edit" width="16" height="16" border="0"></a>'; echo $row['idea']; echo " | "; echo $row['image']; echo '</br>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/137388-solved-parse-error-syntax-error-unexpected/ Share on other sites More sharing options...
premiso Posted December 17, 2008 Share Posted December 17, 2008 First up, $HTTP_GET_VARS is depreciated. Use $_GET['action'] instead. Second up. if ( $action == "edit") { Parans need to be braces ( should be { Quote Link to comment https://forums.phpfreaks.com/topic/137388-solved-parse-error-syntax-error-unexpected/#findComment-717874 Share on other sites More sharing options...
Maq Posted December 17, 2008 Share Posted December 17, 2008 You're using parentheses for your if and else statements on lines: 21 39 41 52 Quote Link to comment https://forums.phpfreaks.com/topic/137388-solved-parse-error-syntax-error-unexpected/#findComment-717875 Share on other sites More sharing options...
hellonoko Posted December 17, 2008 Author Share Posted December 17, 2008 Oh wow. I had a huge bowl of stupid for breakfast. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/137388-solved-parse-error-syntax-error-unexpected/#findComment-717877 Share on other sites More sharing options...
Maq Posted December 17, 2008 Share Posted December 17, 2008 Oh wow. I had a huge bowl of stupid for breakfast. Thanks. lol, mmmmmmm Quote Link to comment https://forums.phpfreaks.com/topic/137388-solved-parse-error-syntax-error-unexpected/#findComment-717879 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.