sterlingevans Posted September 23, 2009 Share Posted September 23, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
Philip Posted September 23, 2009 Share Posted September 23, 2009 $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 Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923242 Share on other sites More sharing options...
sterlingevans Posted September 23, 2009 Author Share Posted September 23, 2009 I don't know, I been looking at i. Im not really good at this Php stuff Been trying to learn it. ??? Ok You have to end your command line so you cant have them on a diffrant line? right Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923247 Share on other sites More sharing options...
ozestretch Posted September 23, 2009 Share Posted September 23, 2009 Hint: ....type = "post" AND wp_posts.post_status = "publish" AN.... Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923250 Share on other sites More sharing options...
redarrow Posted September 23, 2009 Share Posted September 23, 2009 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"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923251 Share on other sites More sharing options...
redarrow Posted September 23, 2009 Share Posted September 23, 2009 that still looks wrong lol sure this is correct 4 ORDER BY wp_posts.post_date DESC do you mean LIMIT 4 Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923252 Share on other sites More sharing options...
sterlingevans Posted September 23, 2009 Author Share Posted September 23, 2009 LOL I get it now It was In " " so they had to be ' ' Ok Thank You so Much!!! Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923253 Share on other sites More sharing options...
sterlingevans Posted September 23, 2009 Author Share Posted September 23, 2009 No the 4 De finds the category to post. Quote Link to comment https://forums.phpfreaks.com/topic/175174-parse-error-syntax-error-unexpected-t_string/#findComment-923256 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.