|
|
|
|
|
|
![]() |
#1 |
WHO IS FONZY!?! Don't they teach you anything at school?
Join Date: Mar 2007
Posts: 45
|
executing php in a wordpress blog post?
I'd like to execute php in a wordpress blog post but can't get it to work.
I tried two different plugins, neither of them work. exec php & run php. With exec php after entering code between the tags it just shows the code in the post instead of showing what the code is telling it to show. Anyone know a way to solve this? |
![]() |
![]() |
![]() |
#2 |
wtfwjd?
Join Date: May 2007
Posts: 2,103
|
Same problem here. I can give you a couple of others to try...didn't work for me, but maybe you'll have better luck.
http://www.daikos.net/widgets/daikos-text-widget/ http://www.erik-rasmussen.com/blog/2...tize-anything/ I'm trying to drop in some php from Dragonscrips, and it just says "cannot connect to server" If you figure it out, let me know... |
![]() |
![]() |
![]() |
#3 |
Oh no, I'm sweating like Roger Ebert
|
I run exec.php and am able to add php to pages without any problem. have never tried posts but can't imagine it would be different.
|
![]() |
![]() |
![]() |
#4 | |
Certified Nice Person
|
Quote:
http://bluesome.net/post/2005/08/18/50/
__________________
Click here to purchase a bridge I'm selling. |
|
![]() |
![]() |
![]() |
#5 | |
Oh no, I'm sweating like Roger Ebert
|
Quote:
|
|
![]() |
![]() |
![]() |
#6 |
WHO IS FONZY!?! Don't they teach you anything at school?
Join Date: Mar 2007
Posts: 45
|
yep. did everything it said.. even installed the role manager, etc..
tried several times & nothing works.. not in a post nor as a page. I have tgp on root & blog in dir. Script is in root & trying to include tgp script in post thats on blog in dir as Code:
<? include("../script.php"); $query = "SELECT COUNT(url) AS numrows FROM links"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result, MYSQL_ASSOC); $numrows = $row['numrows']; $maxPage = ceil($numrows/65); $sql = "SELECT url, title, date FROM `links` ORDER BY date DESC LIMIT ".$offset.", 65;"; $rs = mysql_query($sql); echo mysql_error(); $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } while($row = mysql_fetch_row($rs)){ echo "<a href=\"".$row[0]."\">".$row[1]."</a>".$row[2]."\n<br>\n";} echo "<p>Page: "; $self = $_SERVER['PHP_SELF']; $nav = ''; for($page = 1; $page <= $maxPage; $page++) { if ($page == $pageNum) { $nav .= " $page "; } else { $nav .= " <a href=\"$self?page=$page\">$page</a> "; } } echo $first . $prev . $nav . $next . $last; mysql_close(); ?> Code:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘ 65′ at line 1 Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /dirname/0/blahblah/htdocs/file/name/wp-content/plugins/exec-php/runtime.php(41) : eval()’d code on line 29 |
![]() |
![]() |
![]() |
#7 | |
Certified Nice Person
|
In the docs, the author states:
Quote:
![]() I'm not a PHP guru, so I really couldn't tell you what's wrong with the included script's code.
__________________
Click here to purchase a bridge I'm selling. |
|
![]() |
![]() |
![]() |
#8 | |
WHO IS FONZY!?! Don't they teach you anything at school?
Join Date: Mar 2007
Posts: 45
|
Quote:
The code works fine on a normal php page. Must be some conflict with wordpress & the plugin and I don't know how to fix this as I didn't write this code |
|
![]() |
![]() |
![]() |
#9 |
Oh no, I'm sweating like Roger Ebert
|
It's more than likely a pathing problem in the code. Wordpress is a bit unique in that a post resides within the theme and the path through there would be through your theme.
Try using absolute instead of relative paths and you may be ok. |
![]() |
![]() |
![]() |
|
|