I'm using Ajax to make a connection to the server, and ofcourse it should interact with my php script, and the php script pulls info from a database.
You can't pull a server-side language from a database as far as I know, because if I'm not mistaken, you're probably echoing it. Anything you echo won't be compiled by the server, it will just be outputted to the web page. If you want to compile external PHP, you'll probably have to use include() and use a file, not database.
You could execute PHP code from a database if you use the eval [php.net] function. However, do so with extreme caution and if it was user-supplied content there is absolutely no way I would even consider using this function. I would never use eval on user-supplied data. You would have to be mad to consider it.
Thanks for all the input! Ya what I was trying to do was to create a guestbook , using Ajax and php, and when the user clicks submit the guestbook.php will send the info to a table. All this would've been in local page. But because I couldn't store php I had to remove the php from the database and put it in .php file. but when the user clicks submit it would take them to that php page, therefore breaking the Ajax "feel" I was looking for. I'll try the eval and see how that works. I'll get back to you with the results.