I've just started learning php and I'm having trouble finding the problem when I get it to connect to the database and run an 'INSERT' query. I think the problem is in my connection.php file.
insert.php:<?PHP
echo "into";
include("connection.php");
echo "connected";
$table = blog;
$sql = "INSERT INTO $table SET
Title = '$_POST[title]',
Description = '$_POST[description]',
Content = '$_POST[content]'";
$query = @mysql_query($sql);
echo "complete";
echo $_POST[title];
echo $_POST[description];
echo $_POST[content];
?>
connection.php:
<?php
echo "connection file reached";
$conn = mysql_connect(localhost, user, pass);
mysql_select_db(test, $conn);
echo "connected";
?>
Any advice on my code, or how I could solve this problem would be much appreciated.
EDIT: I'm thinking that it never gets to the connection.php file because it shows the "into" at the top of insert.php but not the "connection file reached" at the top of connection.php. Is that call correct to that file?
Thanks
$tableis not defined.error_reporting(E_ALL);andini_set('display_errors', 1);