Page 1 of 2

Newbie needs advice - why PHP?

Posted: Tue Jan 27, 2004 12:14 pm
by Shujaa
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

Posted: Tue Jan 27, 2004 12:30 pm
by Straterra
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! :)

Posted: Tue Jan 27, 2004 9:15 pm
by Pyrite
PHP is Free :P

Posted: Tue Jan 27, 2004 9:36 pm
by McGruff
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.

Posted: Tue Jan 27, 2004 10:15 pm
by Vicious
Im Just learning PHP and its very straight forward. Very easy to learn. Well for me it is.

Posted: Wed Jan 28, 2004 1:55 pm
by JAM
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? ;)

Posted: Wed Jan 28, 2004 3:47 pm
by Shujaa
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?
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?
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.)
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 ;)

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 do realise that :P
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 :o

Posted: Wed Jan 28, 2004 3:48 pm
by uberpolak
I don't know much about JSP, but Java itself is a pain in the ass to work with... of course if you're alright with that it can be quite useful.

Posted: Wed Jan 28, 2004 11:12 pm
by McGruff
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 ;)
If you expect you might ever want to work on dynamic websites, learn php. It's already big and can only get bigger.

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.

Posted: Tue Feb 03, 2004 5:41 pm
by BDKR
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

:twisted:

Cheers,
BDKR

Posted: Wed Feb 04, 2004 2:59 am
by JayBird
Shujaa wrote:
JAM 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 do realise that :P
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 :o
PHP also stands for Pretty Helpul People :)

Mark

Posted: Wed Feb 04, 2004 11:35 am
by BDKR
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...

Code: Select all

int c;    /* var declaration */
c = 0;
if (c == 18)
    { /* do something here */ }
...where as with PHP, you can just start using a variable.

Code: Select all

/* This is the first appearance of $c */
if($c == 18) 
    { /* do something here */ }
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

Posted: Wed Feb 04, 2004 3:17 pm
by d3ad1ysp0rk

Code: Select all

int c=0;
would be better :P

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.

Posted: Wed Feb 04, 2004 6:08 pm
by BDKR
LiLpunkSkateR wrote:

Code: Select all

int c=0;
would be better :P
Agreed, but I felt it would be better to give the long version. :wink:

Cheers,
BDKR

Posted: Thu Feb 05, 2004 6:28 am
by jason
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.