This PHP code is not printing anyhting and also not able to print the HTML beneath it as well....
The databases and the table are set up and running perfectly. but this query doesnt seem to execute.
<?php
$db = new PDO('mysql:dbname=tipcc;host=localhost;charset=utf8', 'root', 'plsdonthack');
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt=$db->prepare ("INSERT INTO submissions (NAME,TIME,MEMORY,LANG,LINK)
VALUES
(:name,:time,:memory,:lang,:link)");
$stmt->bindParam (':name',$_COOKIE['user'], PDO::PARAM_STR);
$stmt->bindParam (':time',$details['time'], PDO::PARAM_STR);
$stmt->bindParam (':memory',$details['memory'], PDO::PARAM_STR);
$stmt->bindParam (':lang',$details['langName'], PDO::PARAM_STR);
$stmt->bindParam (':link',$details['link'], PDO::PARAM_STR);
if ($stmt->execute ())
{
echo "hoel";
}
else
{
echo "loal";
}
?>
// Some HTML Below.
Error Report :
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'LINK' cannot be null' in /var/www/html/TIP-CC/my_php2.php:171 Stack trace: #0 /var/www/html/TIP-CC/my_php2.php(171): PDOStatement->execute() #1 {main} thrown in /var/www/html/TIP-CC/my_php2.php on line 171
Answer is simple:
I had to use the return value of the function. I was using the IDEONE
API incorrectly.
$result = $client->createSubmission( $user, $pass, $input_code, $lang, $input_data, $run, $private );
and use it as $result['link']