You are invited to Log in or Register a free Frihost Account!

php or js?


I need to ad new features to our website and some of them require to manage cookies and other script-staff.

I have some doubts about which language can fit better, whether php or js. I´m novice for both of them and I think they´re quite similar.

The main goal of the script would be to recognise the user and to load the page with his/her features.

Thank you!
PHP would be your best bet because the script is hidden and it can interact with cookies very easily, not to mention that it can use MySQL
depends on what features and where your getting the data from. If cookies are set then could use JS but if you need a databse or anything else I'd go with PHP. In fact personally I'd go with php anyway.

PHP is server side as in everythign is done on the server and returned to you. JS is client end so your PC does everything.

I'd say to go with php as it should be easier and you can usually get more help Smile
Javascript and PHP forfill completely different tasks. PHP generates a page on the server and javascript executes on the users machine and can manipulate the parsed html and the users browser. You need to use PHP with a database (probably MySQL) to compare the data entered in forms with the database (in this case the usernam and password)...

I'm good at vauge pointing.

EDIT: Dargh... everyone beat me to it.
Can javascript be used to access a particular Database?
Javascript and PHP are completely different. I would say to go with PHP to handle your cookies. first of all its invisible to the client. javascript is only run on the client machine and can be disabled by the user. php is very versitile, especially if you parlay it with a database technology like mysql. The scripts that you write in php never leave the server. it is run by the server and the client never sees the actual script.
I believe there is a way to allow javascript to access a mysql database, but I must warn you against it as all javascript code is able to be read, and therefore your usernames and password etc could be read for your database, allowing to be easily hacked.
That would be the most uselessly unsecure website ever.

ammonkc: You probably didn't mean to but you implied that people couldn't disable cookies in php whitch they can.
Thanks a lot!

I think I'll try PHP... Wink
pecocer wrote:
Thanks a lot!

I think I'll try PHP... Wink

Well Done! Wink
grimboy: I didn't mean to imply that. but thank you for clearifying that. now I can see how that could be misunderstood
matt smith
Php is the best language for data handling, but JS is better for doing things, but I prefer to use PHP. Smile
I think that PHP is the best WL out there
Related topics
Check if the client has JavaScript enabled
What Web Design Software is everyone using?
Web designing?
Welk programma gebruik jij om je website te maken?
Wanna know.....What.
Best free website editors
Which do you prefer ASP,ASP.NET,PHP,JSP?
How do you make a home page!!??
Whats the best PHP 5 editor?
Waiting to begin
PHP Code to HTML
PHP as site template?
htaccess - deny from all and more??? Need help ASAP
If you want to organize and track your Anime/Manga
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.