So I have to change all the mysql_
commands to PDO becuase they are officially depreciated and PDO is the most universal. Why the INSERT ones are so complex and what is benefit of this?
For example in my old code I do this:
mysql_connect("$host", "$username", "$db_password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
mysql_query("INSERT INTO $tbl_name(this, that, him, her) VALUES('$this', '$that', '$him', '$her')")or die(mysql_error());
And with PDO
$conn = new PDO('mysql:host=HST_NAME;dbname=DB_NAME;charset=utf8', 'USER', 'PASSWORD');
$sql = "INSERT INTO books (this, that, him, her) VALUES (:this,:that,:him,:her)";
$q = $conn->prepare($sql);
$q->execute(array(':this'=>$this,
':that'=>$that,
':him'=>$him,
':her'=>$her ));
When I have to input lots of data at once the PDO will get huge. What is the benefit of this?
Looking for a why to do answer and not a what to do