Im new to PHP/MySQL and currently reading PHP and MySQL Web Development by Luke Welling/Laura Thomson. I have been doing tutorials over the internet and I know about how individuals who post tutorials can sometimes not code the best way.

Filename: index.php

My problem:

Cannot connect to database

Example 1:
$con = mysql_connect("localhost","root","root","blog1");
Connects to Database

Example 2:
@ $db = new mysqli('localhost','root','root','blog1');

if (mysqli_connect_errno()) {
	echo "Error: Could not connect to database. Please try again later.";

1.Will only MySQLI work in MAMP, or is there some setting in MAMP that I need to change to use MySQL(Other functions like select and query don't work for me)?
2.Should a beginner be learning the object orientated programming?

Thanks in advance!