Jump to content

Parse error: syntax error, unexpected T_STRING


sterlingevans

Recommended Posts

Hello

 

I had this up and running and it just stoped working i been playing with it for awhile and cant seam to figer it out any ideas

 

Im using WP and I have a PHP Plug-in that alowes me to run php in pages

 

but i keep getting:

 

Parse error: syntax error, unexpected T_STRING in /mounted-storage/home106b/sub005/sc63367-ITYJ/www/wp-content/plugins/phpexec.php(61) : eval()’d code on line 7

 

 

The Page Code looks like this:

 

 

<phpcode>

<?php

require_once('wp-config.php');

// More chimneys! More!

$news=mysql_query("SELECT wp_posts.*, wp_term_relationships.term_taxonomy_id

FROM wp_posts, wp_term_relationships

WHERE wp_posts.post_type = "post" AND wp_posts.post_status = "publish" AND wp_term_relationships.object_id = wp_posts.ID AND wp_term_relationships.term_taxonomy_id = 4 ORDER BY wp_posts.post_date DESC");

echo '<table>';

while($np = mysql_fetch_object($news)){

$meta = mysql_query('SELECT * FROM wp_postmeta WHERE post_id = '.$np->ID);

$meta_temp = array();

while($meta_temp[] = mysql_fetch_object($meta)) {}

for($i = 0; $i < (count($meta_temp) - 1); $i++) {

$np->meta[] = $meta_temp[$i];

}

echo '<tr><td colspan="2">';

echo '<h3><a href="/'.$np->post_name.'">'.$np->post_title.'</a></h3>';

echo '</td></tr>';

echo '<tr><td>'.$np->post_content.'</td>';

echo '<td><ul>';

foreach($np->meta as $num => $array) {

if(substr($array->meta_key, 0, 1) == '_') { continue; }

echo '<li><strong>'.$array->meta_key.':</strong> <em>'.$array->meta_value.'</em></li>';

}

echo '</ul></td></tr>';

}

echo '</table>';

?>

</phpcode>

$news=mysql_query("SELECT wp_posts.*, wp_term_relationships.term_taxonomy_id 
FROM wp_posts, wp_term_relationships
WHERE wp_posts.post_type = "post" AND wp_posts.post_status = "publish" AND wp_term_relationships.object_id = wp_posts.ID AND wp_term_relationships.term_taxonomy_id = 4 ORDER BY wp_posts.post_date DESC"); 

 

Tell me what is wrong with that ;)

Add database protection as well bro.

 

<?php
$news=mysql_query("SELECT wp_posts.*, wp_term_relationships.term_taxonomy_id
FROM wp_posts, wp_term_relationships
WHERE wp_posts.post_type='post' AND wp_posts.post_status ='publish' AND wp_term_relationships.object_id = wp_posts.ID AND wp_term_relationships.term_taxonomy_id = 4 ORDER BY wp_posts.post_date DESC");
?>

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.