i'm trying to make an insertion function that work with any database using PHP & MySQL"PDO Connection" but it didn't work .. here's the Code
<?php
require_once "PDO-Connection.php";
function insert ($table, $column, $value)
{
$data = array ();
foreach($data as $column => $value)
{
$sql = "INSERT INTO $table ($column) VALUES (:$column)";
$stmt = $pdo->prepare($sql);
$stmt -> execute (array(':$column' => '$value'));
}
}
Call this Function
insert ('accounts', 'fname', 'ahmed');
i have (accounts) table & (fname) Field
Thanks in Advance