PHP Cheat Sheet

I’ve put together this ‘cheat sheet’ in the hope that it helps some people, it shows the correct syntax for various statements and I shall add to it as I have time.

PHP Statements
array ( “key” => “value”, … );
die(”messagetoshow”);
echo item;
extract ($array;)
header (”Location: url“);
if (condition) {operation]
elseif (condition) {operation}
else {operation};
session_start();
session_destroy();

PHP MySQL Functions
mysql_connect(”host”,”uname”,”password”);
mysql_select_db(”dbname“);
mysql_query(”query“);
mysql_num_rows($result);
mysql_fetch_array($result,type_of_array);

I hope this helps someone, a lot of it was learned from the dummies book and W3schools :)

-G

This entry was posted in Ramblings and tagged . Bookmark the permalink. Follow any comments here with the RSS feed for this post.

Leave a Reply

Your email is never published nor shared. Required fields are marked *

*

You may use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>