The old school Procedural Approach:
$host_name='xxx'
$username='psychorebellious";
$password="xxxx";
$database="somedb";
$con=mysqli_connect($host_name,$username,$password,$database);
Now the OOP approach
//mysqli is an object type- predefined
$mysqli=new mysqli($hostname,$username,$password,$database);
The OOP approach also replaces some functions with variables(I am unsure if this is the correct word, but they do belong to the object)
Say the Oldschool mysqli_num_rows function that takes the return value of the query as it's parameter, the OOP approach replaces it this way
PROCEDURAL APPROACH
$result=mysqli_query($con,"SELECT*FROM table_name");
$totalrows=mysqli_num_rows($result);
OOP APPROACH
$result=$mysqli->query("SELECT*FROM table_name");
$totalrows=$result->now_rows;
So this is it, I've been using the oldschool way and I recently tried the mysqli OOP approach. As for PHP only I've been using OOP approach (makes things simpler,cleaner and better) but for this mysqli OOP approach, I wonder if that even matters, Why would you not use the old school way instead of the OOP way? Not like that lacked anything.
I am awaiting your precious replies and guidance
-Khan.