Hi Bill,
It could be the code you are using is not using the correct syntax,
The error is in the evaluating of your code which is the most likely possibility, are you sure the code is correct? 🙂
Thanks!
I am seeing the same since upgrading, but can’t say which upgrade (to wp 3.4.2 or upgrading the plugin)
Code
[php]
if ( 1 == 1 ) {
[/php]
this is one
[php]
} else {
[/php]
this is two
[php]
}
[/php]
Output
Parse error: syntax error, unexpected $end in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 3
this is one
Parse error: syntax error, unexpected '}' in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 2
this is two
Parse error: syntax error, unexpected '}' in /mnt/target07/350037/589494/www.rapidresultspersonaltraining.net/web/content/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(373) : eval()'d code on line 2
Hi Jimsander,
Way to hijack!
if you are not using the advanced filter then you cannot break apart your code like that as its being evaluated individually, its the equivalent of creating a new php file with only the contents:
<?php
if ( 1 == 1 ){
which would cause an error anyway.
Thanks
Hit Reach
getting this error message:
Parse error: syntax error, unexpected ‘<‘ in /home/content/97/8218197/html/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(191) : eval()’d code on line 1
from this [allowphp function=1]
<?php
if ( is_user_logged_in() ) {
echo ‘Welcome, registered user!’;
} else {
echo ‘Welcome, visitor!’;
}
?>
@sazanetti
all snippets automatically start with <?php
Try it with that removed.
I used this code:
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('home_sidebar_products') ) : ?><?php endif; ?>
I converted this to [php]code[/php]
but it display same error abow. Please help me to fix this?
Old thread but I figured I’d post my fix in case someone else finds it.
I was getting the:
/wp-content/plugins/allow-php-in-posts-and-pages/allowphp.php(110) : eval()’d code on line 3
error
with the code:
[php]
$result = mysql_query("SELECT Id,Name FROM recipes");
if (!$result) {
echo 'Could not run query: ' . mysql_error();
exit;
}
$row = mysql_fetch_row($result);
echo $row[0]; // 42
echo $row[1]; // the email value
[/php]
I replaced the code with:
[php]
echo 'hello world';
[/php]
it echoed properly and when I replaced hello world with the original code it worked.