jjacquay712 Posted March 3, 2009 Share Posted March 3, 2009 I am having a very strange error I get this: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/johnj/public_html/database/inc_insertintoform.php on line 33 when I run this code: <?php if ( $rows != 0 ) { $post_count = count($_POST); if ( $post_count > 0 ) { //Insert Post Data $table = explode("from", $query_trim); $query = "INSERT INTO " . $table[1] . "("; foreach ($_POST as $title=>$data) { $for_counter++; $query .= $title; if ( $for_counter != $post_count ) { $query .= ","; } } $for_counter = 0; $query .= ") VALUES("; foreach ($_POST as $title=>$data) { $for_counter++; $query .= "'" . $data . "'";` if ( $for_counter != $post_count ) { $query .= ","; } } $query .= ");"; mysql_query($query);//insert into crap echo '<p>Done! ' . $query . '</p>'; } /*else { if ( substr($query_trim, 0, 6) == "select" ) { //echo form echo '<p>Insert Into Table Form</p>'; echo '<form name="insert" method="post" action="">'; foreach ( mysql_fetch_assoc(mysql_query($_GET['query'])) as $title=>$data ) { echo '<label>'; echo $title . ': <input type="text" name="' . $title . '" id="' . $title . '">'; echo '</label><br />'; } echo '<br /><label><input type="submit" id="button" value="Submit"></label></form><br />'; } }*/ } ?> I even have line 33 commented out! What is going on? Link to comment https://forums.phpfreaks.com/topic/147726-solved-very-strange-error/ Share on other sites More sharing options...
Mchl Posted March 3, 2009 Share Posted March 3, 2009 You have a back tick here $query .= "'" . $data . "'";` (line 20)[/code] Link to comment https://forums.phpfreaks.com/topic/147726-solved-very-strange-error/#findComment-775447 Share on other sites More sharing options...
jjacquay712 Posted March 3, 2009 Author Share Posted March 3, 2009 Oh My God.... Its so tiny i didn't even see it! (thats what she said) Thanks so much for the help! Link to comment https://forums.phpfreaks.com/topic/147726-solved-very-strange-error/#findComment-775452 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.