|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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? |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP function in database article |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|