I am trying to include config.php
file for database after completing task , redirect to other page but it shows this error message.
"Warning: Cannot modify header information - headers already sent by (output started at /home/prasan/public_html/theyplay.in/texttospeech/config.php:16) in /home/prasan/public_html/theyplay.in/texttospeech/input.php on line 14"
<?php
include("config.php");
try {
$mi = $_POST['main'];
$i = $_POST['item'];
$dbo->query("INSERT INTO LD (mainitem, subitem, item,fav)VALUES ('$mi','$i',0)") ;
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
header("Location: index.php");
?>
Edit: config.php
<?php
$dbhost_name = "localhost";
$database = "rrr";
$username = "rrr";
$password = "rrr";
try {
$dbo = new PDO('mysql:host=' . $dbhost_name . ';dbname=' . $database, $username, $password);
}
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
"; die(); } ?> – Lalit Singh Jun 01 '14 at 10:09