I am having some problems Inserting values into a database. Here is my code.
<?
$table_name="content";
include("config.php");
$connection = @mysql_connect ($host, $username, $pass) or die ("Could not connect to database please contact administrator.");
$db = @mysql_select_db($db_name, $connection) or die("Could not select database please contact administrator.");
if ($action == view) {
$sql = "SELECT * FROM home";
$result = @($sql, $connection) or die("Could not execute query please contact administrator.");
while ($row = mysql_fetch_array($result)) {
$content =$row['content'];
$display_block = "$content";
}";
}
if ($action == update) {
$sql1= "INSERT INTO $table_name (text) VALUES (\"$text\")";
$result = @($sql1, $connection) or die("Could not execute query please contact administrator.");
}
?>
I get an error with this statement
$sql1= "INSERT INTO $table_name (text) VALUES (\"$text\")";
Please help.