Getting Zero Errors using an Insert command but 0 data is going into my Database

Hi,

I got a database with 2 columns. Retrieving data from it I have 0 problems, but inserting Data is a different story. The code I got from a tutorial seems pretty straightforward, but implementing it seems a bit of a challenge especially that I am getting 0 errors. Been at this code for quite sometime, and I think at this point it would be beneficial to have someone take a second look at it.


 
try{
$conn = new PDO('mysql:host=Jamal-PC;dbname=japanesewords',$username,$password);


if(isset($_POST['EnglishWord'])){
$Englishword = $_POST['EnglishWord'];
$Japaneseword = $_POST ['JapaneseWord'];
echo '<pre>';
print_r($_POST);
echo '</pre>';
$q = "INSERT INTO Japanesedefinition(Japaneseword,Englishword)VALUES(:Japaneseword,:Englishword):";
$query = $conn->prepare($q);
$result = $query->execute(array(
":Englishword"=>$Englishword,
":Japaneseword"=>$Japaneseword

));
}
}catch(PDOException $e){
 echo 'ERROR: ' . $e->getMessage();
}

}
myTest();

The query returns:
Array
(
    [JapaneseWord] => konnichiwa
    [EnglishWord] => hi
)




The variables have to be pound to parameters, this is done inbetween preparing the SQL query and executing it. Have a read of the http://php.net/manual/en/pdostatement.bindparam.php for some more info

Okay, the only thing I see is the : at the end of your Query… Execute can take an array to bind on prepared statements, so that looks okay.

What looks odd, is the part in red

"INSERT INTO Japanesedefinition(Japaneseword,Englishword)VALUES(:Japaneseword,:Englishword)[color=red][b]:[/b][/color]"

Try echoing out $query->errorInfo(); after the execute.

It was the bloodily colon. Thank you so much.