Hey guys, here are a few tips that might help you, that in my opinion would be good to consider!
1. Use MySQLi functions instead of MySQL functions
You can use the functions procedurally or as an object, so the learning curve is very easy. A lot of the functions have very similar names. With MySQLi you can create prepared statements, you might not need them right now, but the option will be good later on. If you want to get a better head start than this, I would recommend learning PDO, but that has a hard learning curve.
2. Use descriptive camelCase $variables
A regular variable can be confusing if you read your own code later, $myvar or $item does not make much sense, unless you want to re-study your code a year later! So try to be descriptive and camelCase variables, it is a popular naming convention used in Java and Zend Framework. A variable would be something like this: $inputFileName
3. Master the Array's and Multi-Dimensional Arrays
You will work with arrays a lot and they have a lot of power. When you understand how to re-arrange things and grab what you need you will see they are life-savers in many situations!
Tip: If you don't assign a key, it will use a digit by default
Some great array functions to start with:
// Enumerated arrays (Digits are used for the key)
$b = array ('dog', 'cat', 'fish', 10 => 255);
echo $b; // Gives you dog
echo $b // Gives you an error, because 255 is the value not they key!
$variable['key'] = 'value'
// Associative arrays (Words used for the key)
$c = array ('fish' => 'big', 'dog' => 'fat')
echo $c['fish'] // Gives you 'Big'
echo $c // Gives you an error, the keys are associative not enumerated.
// Multi-Dimensional Array (An array that has more arrays in it)
$d = array('cat' => array(
'dog' => 'none');
echo $d['cat'] // Grabs 'brown'
echo $d['cat']['yellow'] // Error, yellow is the value!
echo $d['dog'] // Gives you 'none'
* and some of the sorting ones
4. Comment your code
You don't have to get obsessive over it, but it might save you a lot of sweat from your forehead someday trying to figure out what you were doing. An example of a comment is with phpDoc and it looks like this:
Alternatively you can also name all your arguments like this:
* @desc This function does nothing
This way you can write your projects documents while you program it. It takes a little effort and habit to get into, but it is going to help you someday.
* @desc This function does nothing
* @var <str> $strInput An input string that does nothing right now...
5. When you are bored, practice OOP
Objects will change your programming life and make you capable of many more things. It is tricky to learn at first, and tricky to see the value at first. But after a few months of doing OOP you will be one of the happiest people alive.
Even if you don't totally understand what you are doing, doing a little bit each day will stick in your mind and you'll be able to recall things you've read about and the understanding comes together like building blocks.
6. Ask stupid questions if Google wont help you
Its easiest to ask a question where your problem rests, rather than sending a huge 300 line copy paste I noticed when you ask short and simple questions people are on it like a dog on a raw bone, they want to be the first to answer. But people tend to avoid the lengthy long questions where they must dig through a ton of code. So try to find where your error lies, and keep it simple.