Parse Error: Syntax Error, Unexpected '' (T_Encapsed_And_Whitespace)

Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)

You have extra single quotes :

$introduction="INSERT INTO Introduction (Title, Description)
VALUES ('$_POST[introtitle]','$_POST[introdescription]')";

syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)

You have to change your code as below:

echo "<img src='$row[logo]' /><br />";

OR

echo "<img src='".$row[logo]."' /><br />";

Error : ( ! ) Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING)

echo $row['Fullname']."  ".$row['studentNo']."  ".$row['SubjectName']."  ".$row['GPA']."  ".$row['CGPA']."  ".$row['SCORE']."<br/>";  // Error here

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:/... on line 10

You have syntax errors in your query. You need to have the curley brackets around every $_POST in your query, and your query should be ... VALUE (....)

change -

$sql= "INSERT INTO inside VALUES{($_POST['name']),($_POST['telephone']),($_POST['comment'])}";

to

$sql= "INSERT INTO inside VALUES ( {$_POST['name']}, {$_POST['telephone']},{$_POST['comment']})";

see

http://dev.mysql.com/doc/refman/5.6/en/insert.html

and

http://php.net/manual/en/language.types.string.php#language.types.string.parsing.complex


also, you should not be inserting user data directly into your database. take a look at

How can I prevent SQL injection in PHP?

PHP syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING

The correct syntax is:

{{ URL::to('user/reset', array($token)) }}

PHP: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE)

The way in which you were embedding the php tags within the quoted string was causing the issue. You will find it easier to format the code properly IMO! I think the following ought to be ok, the values are now encapsulated in curly braces.

    while($row = mysql_fetch_array($query) or die(mysql_error())){

echo '<form>';
while ($row=mysql_fetch_array($query))
{

echo '<div class="boxed" >';

echo "\t".'<tr><th>'.
$row['question']."<br>".
'</th><th>'."<input type='radio' name='optn' value='{$row['A']}'>".$row['A']."<br>".
'</th><th>'."<input type='radio' name='optn' value='{$row['B']}'>".$row['B']."<br>".
'</th><th>'."<input type='radio' name='optn' value='{$row['C']}'>".$row['C']."<br>".
'</th><th>'."<input type='radio' name='optn' value='{$row['D']}'>".$row['D'].'</th>
</tr>';
echo '<input type="submit" name="submit" />';

echo '</div>';
}
echo '</form>';
}

Below is a re-written version which, I think, better illustrates the problems in the code you gave.

while( $row = mysql_fetch_array($query) or die(mysql_error())){
echo '<form>';
while( $row=mysql_fetch_array( $query ) ){
echo "
<div class='boxed'>
<tr>
<th>
{$row['question']}<br>
</th>
<th><input type='radio' name='optn' value='{$row['A']}'>{$row['A']}<br>
</th><th><input type='radio' name='optn' value='{$row['B']}'>{$row['B']}<br>
</th><th><input type='radio' name='optn' value='{$row['C']}'>{$row['C']}<br>
</th><th><input type='radio' name='optn' value='{$row['D']}'>{$row['D']}</th>
</tr>
<input type='submit' name='submit' />
</div>";
}
echo "</form>";
}

There is no table tag yet you have tr and th tags and there is a nested while loop...

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE

This should work:

<select id="cd" name="cd">
<?php
while($row=mysql_fetch_array($cdresult)) {
echo "<option value=".$row['Poblacion']."></option><br/>";
}
mysql_close($link);
?>
</select>


Related Topics



Leave a reply



Submit