For a long time I've been using MySQL and I'm using more MySQLi nowadays.
I'm thinking about switching to PDO or get more out of MySQLi. I don't know what will be better and how our future looks like, unfortunately
I've seen some examples online about PDO and have seen that CREATE, INSERT, DELETE, UPDATE query/functions are not the same.
example i need (depending on the query) to use :
$db->exec();
$db->execute();
$db->prepare();
Cause there are different ways to do the same it will make me personally confused and not easy to make a function or class of them.
My question here is if i can use the same query's with different databases or do i have to write my code depending on what database i use. I found this code online.. They are (almost but) not the same.
MySQL
$sql = "CREATE TABLE user (
id INT(11) NOT NULL AUTO_INCREMENT,
name VARCHAR(80) NOT NULL,
email VARCHAR(50) NOT NULL,
PRIMARY KEY (id))";
$mysql->exec($sql);
SQLLite
$sql = "CREATE TABLE books(
id int,
title varchar(255),
author varchar(255))";
$sqllite->exec($sql);
Do i miss something? Am i seeing this wrong? Can i write the same code for different databases? UPDATE, INSERT, DELETE, CREATE, DROP
Everybody writes positive about PDO... I am always seeing things different Maybe someone can share his opinion or awnser my question to start with, before to jump into something new. Thanks