- Joined
- Apr 7, 2009
- Messages
- 647
- Reaction score
- 25
I'm pretty tired of seeing people asking for help on basicPHP stuff, so Ima just gonna make a completely basic reference guide.
That's prety much all you'll need for basic coding, update this later.
PHP:
echo "string"; - Writes string to the website. String is HTML.
print "string"; - Pretty much the same thing as above.
$name - creates a variable. Variables always must be called with a $, followed by the variable name.
$_GET['global var'] - I believe its called a global var, but anyways, this gets the page variable thing. For example - ?cype=... or newthread.php?do=newthread...
If you were to do $_GET['cype'], that would return whatever is after the ?cype=.
mysql_real_escape_string(var_to_escape) - Escapes all dangerous characters in a mysql query. Crucial for preventing SQL injection (Although bypassable.)
stripslashes(var_to_strip_slashes) - Strips slashes('\') from the parameter specified.
isset(var) - checks if the variable is set.
session_start() - loads all session data
$_POST - gets elements from a form
$_SESSION - session data
session_destroy() - Ends the session.
<b></b> - Bolded text
<i></i> -Italicized text
<u></u> - Underlined text
<a href="url">Link Name</a> - Creates a link with the link name, if you don't want a link name, don't add the Link Name and the </a> (Optional: target="_blank" after "url" - Opens the link in a new window.
<a name="tag_name"></a> - Creates a tag, so users don't needto scroll to the area. To use a tag, you use, site.tld/name.php#tag_name
That's prety much all you'll need for basic coding, update this later.
Last edited: