Jump to content

[SOLVED] Very Strange Error


jjacquay712

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.