FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP and MySQL FAQ - Read Before posting!





rvec
This topic should become the PHP and MySQL FAQ. If you have any suggestions post them and I'll update this post. Please post them in the same format I am using to make it easy for me.

All code here is written for PHP5 because frihost supports that on all servers and because php4 isn't used a lot any more.

Read this before posting anything about file uploads!!!!
http://tstarling.com/blog/2008/12/secure-web-uploads/
If you don't read that and have security problems your topic will be locked!
That blog post is also very good reading material for more experienced programmers.

Code:
[size=18]Question?[/size]
Answer


How do I use XML with PHP?
First put all the data in a variable (ie. with fopen). Then use SimpleXML to make an object of the xml file.

How do I use cookies?
To set a cookie use setcookie. To read the cookie use $_COOKIE['var'].
this will output: value
Code:
setcookie("TestCookie", 'value');
echo $_COOKIE["TestCookie"];
Note that you can only set cookies before sending any output to the user.

How do I use sessions?
At the beginning of every PHP file where you want to use sessions use this code before you send any output to the user (of course after the php opening tag):
Code:
session_start()

Now you can use $_SESSION as a normal array. You can store stuff in it and it will be in the session array untill the session has expired or the user closed the browser.

Does frihost have extension x enabled?
To see all the info about the frihost php installation take a look at the php info pages. The info pages for server 1, server 2 and server 3. New accounts are created on server 3. If you want to know on what server you are on pm a mod or admin.

How do I start with PHP?
Read through these topics before asking questions. They can help you get started:
http://www.frihost.com/forums/vt-87990.html
http://www.frihost.com/forums/vt-87603.html
http://www.frihost.com/forums/vt-8719.html

Where can I get good PHP documentation?
The PHP group has an extended PHP manual with user contributed notes. It's available in both online format and downloadable version at http://www.php.net/docs.php

Can you help me with my PHP script? There's something wrong with it!
Yes, most of Frihost users will help. But remember to provide with a detailed description of the problem and a copy of the script. The more info you provide, the faster you'll get help.
Star Wars Fanatic
Very nice, this is a great idea, will help answer a lot of questions before they are even asked.
BlueVD
Where can I get good PHP documentation?
The PHP group has an extended PHP manual with user contributed notes. It's available in both online format and downloadable version at http://www.php.net/docs.php

Can you help me with my PHP script? There's something wrong with it!
Yes, most of Frihost users will help. But remember to provide with a detailed description of the problem and a copy of the script. The more info you provide, the faster you'll get help.
rvec
those are good questions, thanks. I added them Smile
chai_aicah
help me! i dont know how to begin php.

what will i install???
Star Wars Fanatic
chai_aicah wrote:
help me! i dont know how to begin php.

what will i install???


That question is already in the FAQ above, here is the answer, though I don't know why I have to post it for you...

Read through these topics before asking questions. They can help you get started:
http://www.frihost.com/forums/vt-87990.html
http://www.frihost.com/forums/vt-87603.html
cyberbuddy
this forum really helped me about clearing of my doubts in php .any way thanks to those all who have contributed these knowledge
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.