Newbie needs advice - why PHP?
Moderator: General Moderators
Newbie needs advice - why PHP?
Hi, newbie here, need some advice.
Got a Uni project to do concerning making a web-based system that will allow users to fill in forms to apply for student accomodation. Forms will be stored in a mySQL database.
I'm unsure of what serverside scripting language to use here, having no real experience with any of them. I hear good things about PHP for something like this, but am also considering JSP because I have some experience programming in Java itself, and am thinking perhaps the familiarity would make it easier.
I would like to hear reasons from you guys about why PHP would be best suited (if indeed it is) over another language. Thanks in advance.
Shujaa
Got a Uni project to do concerning making a web-based system that will allow users to fill in forms to apply for student accomodation. Forms will be stored in a mySQL database.
I'm unsure of what serverside scripting language to use here, having no real experience with any of them. I hear good things about PHP for something like this, but am also considering JSP because I have some experience programming in Java itself, and am thinking perhaps the familiarity would make it easier.
I would like to hear reasons from you guys about why PHP would be best suited (if indeed it is) over another language. Thanks in advance.
Shujaa
-
Straterra
- Forum Regular
- Posts: 527
- Joined: Mon Nov 24, 2003 8:46 am
- Location: Indianapolis, Indiana
- Contact:
Using PHP in this situtation could be done VERY VERY easily. If you use PHP, you will have to follow these steps.
1. Page gets the information posted using $_POST['variablename'] and assigns it into a varable $variablename.
2. The same page opens up MySQL, and inserts a row of data using the variable created in line 1.
3. The same page then tells the user that either it worked or did not.
Here are the links for what you will need.
http://www.sqlcourse.com (If you don't know the SQL language)
http://us4.php.net/manual/en/reserved.v ... ables.post (For information on $_POST)
http://us4.php.net/mysql (For the MySQL functions)
Read up on those websites, and ask all the questions you need and you will be done in no time!
1. Page gets the information posted using $_POST['variablename'] and assigns it into a varable $variablename.
2. The same page opens up MySQL, and inserts a row of data using the variable created in line 1.
3. The same page then tells the user that either it worked or did not.
Here are the links for what you will need.
http://www.sqlcourse.com (If you don't know the SQL language)
http://us4.php.net/manual/en/reserved.v ... ables.post (For information on $_POST)
http://us4.php.net/mysql (For the MySQL functions)
Read up on those websites, and ask all the questions you need and you will be done in no time!
I have no experience of java so I'm not best placed to compare the two.
Java has a reputation of being more powerful for "enterprise level" applications.
Php has a reputation for being easy to learn and very quick to develop new apps with. No compiling for one thing. I think it's ideal for your project.
Why don't you download a local server and try it out.
I use easyphp - painless installation.
Also, you'll need the manual at php.net - if you're on dial up can download a version with user comments (recommended).
Mysql.com have the mysql manual - naturally.
Take a look at the eclipse code for an example of good php coding.
Java has a reputation of being more powerful for "enterprise level" applications.
Php has a reputation for being easy to learn and very quick to develop new apps with. No compiling for one thing. I think it's ideal for your project.
Why don't you download a local server and try it out.
I use easyphp - painless installation.
Also, you'll need the manual at php.net - if you're on dial up can download a version with user comments (recommended).
Mysql.com have the mysql manual - naturally.
Take a look at the eclipse code for an example of good php coding.
Mainly a copy of McGruff's post but...
JSP is mostly used in n-tier environment using dedicated servers as said, but if you feel fluent with it and it is just to "pass the test" so to speak, why not?
On the other hand, it's likely easier to download a PHP supporting webserver (does not have to be Apache), PHP and MySQL and start testing things locally.
And PHP is bigger in the sence that you will likely find more resources and how-to's that would guide you in your path to the finished product.
Another thing to take in consideration is what you intend to do after school. Are you doing this project just to get by, or to achieve something and perhaps work as an proffessional later? (Asuming you attend at school as a student, not a worker that is.)
Sidenote:
No offence; but have in mind that you ARE asking this question on a PHP "more or less only" forum, so what did you expect as answer?
JSP is mostly used in n-tier environment using dedicated servers as said, but if you feel fluent with it and it is just to "pass the test" so to speak, why not?
On the other hand, it's likely easier to download a PHP supporting webserver (does not have to be Apache), PHP and MySQL and start testing things locally.
And PHP is bigger in the sence that you will likely find more resources and how-to's that would guide you in your path to the finished product.
Another thing to take in consideration is what you intend to do after school. Are you doing this project just to get by, or to achieve something and perhaps work as an proffessional later? (Asuming you attend at school as a student, not a worker that is.)
Sidenote:
No offence; but have in mind that you ARE asking this question on a PHP "more or less only" forum, so what did you expect as answer?
That's just it - I am happy with coding in Java, but is JSP the very same language? What I'm concerned with is that coding certain things that I will need may not be very straightforward with JSP, whereas since PHP is designed for this it'll be more streamlined. Can you comment on that supposition?JAM wrote:Mainly a copy of McGruff's post but...
JSP is mostly used in n-tier environment using dedicated servers as said, but if you feel fluent with it and it is just to "pass the test" so to speak, why not?
Can you elaborate? My gut tells me that knowing PHP would be very useful later on, but better to hear from people with experience I thinkAnother thing to take in consideration is what you intend to do after school. Are you doing this project just to get by, or to achieve something and perhaps work as an proffessional later? (Asuming you attend at school as a student, not a worker that is.)
I do realise that
No offence; but have in mind that you ARE asking this question on a PHP "more or less only" forum, so what did you expect as answer?
I posted a similar post on JSP forums, hoping to get a decent comparison upon which I can make a decision. Unfortunately none of them have replied yet, so PHP is in the lead
If you expect you might ever want to work on dynamic websites, learn php. It's already big and can only get bigger.Can you elaborate? My gut tells me that knowing PHP would be very useful later on, but better to hear from people with experience I think
A few years down the line, once we've all got direct mind-to-internet connections, it's php we'll be using to talk to each other.
Better get started now.
I know I'm coming to the party late, but I think this is the best reason yet. Just read...
http://php.weblogs.com/discuss/msgReader$2674
Cheers,
BDKR
http://php.weblogs.com/discuss/msgReader$2674
Cheers,
BDKR
PHP also stands for Pretty Helpul PeopleShujaa wrote:I do realise thatJAM wrote: No offence; but have in mind that you ARE asking this question on a PHP "more or less only" forum, so what did you expect as answer?
I posted a similar post on JSP forums, hoping to get a decent comparison upon which I can make a decision. Unfortunately none of them have replied yet, so PHP is in the lead
Mark
Something to consider is the fact that scripting languages like PHP, Python, and Ruby have the advantage or requiring fewer actually lines of code compared to C, C++, Java, etc...., by virture of being dynamically typed. This translates into increased productivity. This is something that many people in the Java and C++ camp (artima.com is a good place to see examples of this) are noticing.
Anyway, in C, as an example, you have to do...
...where as with PHP, you can just start using a variable.
Of course, the engine will still gripe (issue a warning) at a certain level, but the program will still run.
I think this kind of thing has a lot to do with why it's SO EASY to pick up PHP. All a new person has to deal with is just the logic of the program. With C and C++, there are issues of types and memory allocation, which really taxes the coder a lot on a mental level.
One more reason I believe PHP has picked up so much faster than Python and Ruby is due the fact that it's first a procedural language (with an easy syntax and small vocabulary, unlike Perl). A nooB3 has nothing more to worry about than just logic flow and doesn't have to also assimilate the use of objects. With PHP, a joe could learn how to code in general, then come back and learn OO.
Cheers,
BDKR
Anyway, in C, as an example, you have to do...
Code: Select all
int c; /* var declaration */
c = 0;
if (c == 18)
{ /* do something here */ }Code: Select all
/* This is the first appearance of $c */
if($c == 18)
{ /* do something here */ }I think this kind of thing has a lot to do with why it's SO EASY to pick up PHP. All a new person has to deal with is just the logic of the program. With C and C++, there are issues of types and memory allocation, which really taxes the coder a lot on a mental level.
One more reason I believe PHP has picked up so much faster than Python and Ruby is due the fact that it's first a procedural language (with an easy syntax and small vocabulary, unlike Perl). A nooB3 has nothing more to worry about than just logic flow and doesn't have to also assimilate the use of objects. With PHP, a joe could learn how to code in general, then come back and learn OO.
Cheers,
BDKR
-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
Code: Select all
int c=0;but i agree, php is much more simplistic, all the functions are straight to the point and do what you want. and programs are just easy to write in general.
Agreed, but I felt it would be better to give the long version.LiLpunkSkateR wrote:would be betterCode: Select all
int c=0;![]()
Cheers,
BDKR
I do know that the syntax IS a bit different, and that basically, when all is said and done, JSP is nothing more than a more wordy version of PHP, at least IMHO.
If you know Java, and can afford the time to pick up PHP (which is not difficult ot learn), learn PHP. The extra knowledge isn't bad. Knowing both Java and PHP gives you a leg up on people who know just Java (and those that know just PHP). However, if you don't have the time, JSP could be the way to go.
The one difference is that PHP has been built for the web, so you may find a lot of functions that are build with that in mind, that would make building a web application easier in PHP.
If you know Java, and can afford the time to pick up PHP (which is not difficult ot learn), learn PHP. The extra knowledge isn't bad. Knowing both Java and PHP gives you a leg up on people who know just Java (and those that know just PHP). However, if you don't have the time, JSP could be the way to go.
The one difference is that PHP has been built for the web, so you may find a lot of functions that are build with that in mind, that would make building a web application easier in PHP.