PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old January 11th, 2003, 03:51 AM
MarnixK MarnixK is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 5 MarnixK User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP function in database article

i have a site with PHP and MySQL.
I store some article in a database and show those
on my site.

Now I wan't to use a selfmade php_function in those articles stored in the database. But when I load the page it doesn't execute the function, it just says show_image('test.jpg') and not the image.

Is it possible to store those things in a database and execute them.

The function is stored in a different library file which it included in every page I load.

Reply With Quote
  #2  
Old January 11th, 2003, 05:22 AM
Jeb. Jeb. is offline
"l33t? What's l33t?"
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 51 Jeb. User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to Jeb.
MarnixK,

If it just says 'showimage('test.jpg')', it sounds like PHP isn't parsing this as PHP code. You might want to check to ensure it's been wrapped in the PHP start and end tags. Even if you include() a file, you still need to wrap it in these tags.

Peace,
Jeb.
__________________
Jeb.

AIM: JebediahMc - PM Me - E-Mail Me


Reply With Quote
  #3  
Old January 11th, 2003, 10:53 AM
jpenn jpenn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: Washington, DC
Posts: 317 jpenn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 3 sec
Reputation Power: 6
Post your code please. I would like to see the page you are storing and the function you are are trying to call.

It may be simple using eval() - or may be complex, but we first need to see the code....
__________________
~ Joe Penn

We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set?

Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you.




Reply With Quote
  #4  
Old January 11th, 2003, 02:07 PM
Brian Rosner Brian Rosner is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: Denver, CO
Posts: 34 Brian Rosner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Brian Rosner Send a message via AIM to Brian Rosner Send a message via Yahoo to Brian Rosner
Well using eval() may do the trick, but you will need to do some things to you article first. If you were to retrieve the article from the database and just use eval() on the body you'll end up with parse errors etc.. so you would need to make your article in a php structure like each line in a variable. for example

$str = "my article title\n";
$str .= "blah\n";

and do that with each line of the article and when you get to your function it would have to

$str .= "check this image out" . showimage($blah) . " neat huh";

or another way that maybe easier is to inclose that in a defined tag and use regular expressions to find them all...

[SHOWIMAGE http://www.domain.com/image.gif /]

You see what I mean?

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > PHP function in database article


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway