Hello Everyone,

I am totally new to php, I would like to know if I can be able to use it. within my website,I am using javascript and a database.

what is the relation between php and ajax. Can I use php if I am using javascript? How can I start using php within my java project? Where is php code written in?

Thanks

Recommended Answers

All 4 Replies

Firstly PHP is server side while Javascript is Client side.
If you want a fully functional site you will need PHP
and you can use javascript yo make it dinamic.

Firstly PHP is server side while Javascript is Client side.
If you want a fully functional site you will need PHP
and you can use javascript yo make it dinamic.

Thank you, but you have not answered all my questions, where can I use PHP and how?

Where exactly does PHP's functionality lie in?

Member Avatar for diafol

OK, you will probably need a local copy of php, mysql and Apache. You can download the xampplite package from xampp. Once this is installed, you go to c:\xampplite\htdocs\ and start placing your php/web files in there. To view them, simply lookup something like http://localhost/mypage.php in your browser. If everything seems OK, simply FTP your files to your remote site (you have to buy a domain name and get some hosting for your site - there are loads of cheap hosts out there).

For a quick scan of php usage, look up w3schools. JS works 'in the browser' (client) or on YOUR computer. php works on the webserver - this could be your machine if you're using localhost or your host's machine if you're using a remote site. php always runs before js.

Ajax is simply a method to stop whole page refreshes when you want the server (php) to react to an action by the user (js). A js script is run (e.g. by link click or button press) which calls a php script which can do all sorts of stuff. The js then usually gets a response to this and updates an area of the page with this info. This is just a small part of what you can do with ajax. If you are considering using Ajax, I would suggest that you use something like jQuery, which eases the pain of dealing with the ajax object better than morphine.

I don't see why you'd want to use php in Java. I assume you mean Java as opposed to Javascript.

Thank you ardav for your clarification.

I have my work on a java web application, I know see that php is not crucial for the ajax goals I need. I am user servlets anyways so I dont think a php application has servlets.

Thanks again

OK, you will probably need a local copy of php, mysql and Apache. You can download the xampplite package from xampp. Once this is installed, you go to c:\xampplite\htdocs\ and start placing your php/web files in there. To view them, simply lookup something like http://localhost/mypage.php in your browser. If everything seems OK, simply FTP your files to your remote site (you have to buy a domain name and get some hosting for your site - there are loads of cheap hosts out there).

For a quick scan of php usage, look up w3schools. JS works 'in the browser' (client) or on YOUR computer. php works on the webserver - this could be your machine if you're using localhost or your host's machine if you're using a remote site. php always runs before js.

Ajax is simply a method to stop whole page refreshes when you want the server (php) to react to an action by the user (js). A js script is run (e.g. by link click or button press) which calls a php script which can do all sorts of stuff. The js then usually gets a response to this and updates an area of the page with this info. This is just a small part of what you can do with ajax. If you are considering using Ajax, I would suggest that you use something like jQuery, which eases the pain of dealing with the ajax object better than morphine.

I don't see why you'd want to use php in Java. I assume you mean Java as opposed to Javascript.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.