Jump to content

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");
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.