This is my header.php:
<head>
<?php
require_once ('config/config.php');
?>
<title><?php echo main_title ?></title>
</head>
<?php
require_once ('config/connection.php');
?>
This is my config.php:
<?php
define("server","localhost");
define("db_user","myusername");
define("db_pass","mypassword");
define("db_name","mydbname");
define("main_title","mywebsitetitle");
?>
This is my connection.php
<?php
$connect= @mysql_pconnect(server,db_user,db_pass) or error_log("'Sorry, I was unable to esablish a connection because: '.mysql_error().' !'");
$db_select=@mysql_select_db(db_name,$connect) or error_log("'Sorry, I could not select the requested database because: '.mysql_error().' !'");
?>
This is my form in callme.php:
<form action="addquestion.php" method="post" enctype="text/plain" name="ask me">
Name: <input name="name" type="text" style="width: 200px" tabindex="1">
Email: <input name="email" type="text" style="width: 200px" tabindex="2">
Subject: <input name="subject" type="text" style="width: 200px" tabindex="3">
Text: <textarea name="text" style="width: 250px; height: 150px" tabindex="4"></textarea>
<input name="Submit" type="submit" value="SEND" style="font: 100% Tahoma; width: 100px" tabindex="5">
</form>
This is my addquestion.php code:
<?php
include ('header.php');
$name = @mysql_real_escape_string($_POST['name']);
$email = @mysql_real_escape_string($_POST['email']);
$subject = @mysql_real_escape_string($_POST['subject']);
$text = @mysql_real_escape_string($_POST['text']);
$insert_query ="INSERT INTO 'mytable' ('name', 'email', 'subject', 'text') VALUES ($name, $email, $subject, $text)";
mysql_query($insert_query) or die (mysql_error());
?>
This is the error message that results from addquestion.php:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''mytable' ('name', 'email', 'subject', 'text') VALUES (, , , )' at line 1
Thanks in advance