I am converting old mysql to PDO.
Old working code:
$sql='INSERT INTO `plat_wiadomosci`( `wiad_oddzial`, `temat`, `tresc`,`id_user`,`ip`,`data_wiadomosci`,`wiad_telefon`,`wiad_zrobiony`) VALUES ("'.$_POST['tt'].'","'.$tytul.'","'.$_POST['wiadomosc'].'","'.$_POST['did'].'","'.$_SERVER['REMOTE_ADDR'].'","'.time().'","'.$_POST['telefon'].'","0")';
mysql_query($sql);
New code in PDO:
$stmt=$db->prepare('INSERT INTO `plat_wiadomosci`( `wiad_oddzial`, `temat`, `tresc`,`id_user`,`ip`,`data_wiadomosci`,`wiad_telefon`,`wiad_zrobiony`) VALUES (?,?,?,?,?,"'.time().'",?,"0")');
$stmt->execute(array($_POST['tt'],$tytul,$_POST['wiadomosc'],$_POST['did'],$_SERVER['REMOTE_ADDR'],$_POST['telefon']));
First code is writing into database the other won't, any suggestion ?
Connection:
$db = new PDO('mysql:host=localhost;dbname='.$dbname12.';charset=utf8', $dbuser23, $dbpsw34);
$db->exec("set names utf8");
After error info: i pasted after exec, print_r($db->errorInfo()); i get
Array ( [0] => 00000 )