mysql version 5.1.30
this is the query that fails
It is
mysql_query('INSERT INTO bugs (id, reporter, title, desc) VALUES ('', '$username', '$title', '$desc')') or die('Could not insert data because '.mysql_error());
It does not return an error code. Here is the entire script.
<?php
session_start();
require_once("config.php");
// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());
// select the database
mysql_select_db($database)
or die ("Could not select database because ".mysql_error());
$username = mysql_real_escape_string($_POST['reporter']);
// insert the data
$title = $_POST['title'];
$desc = $_POST['desc'];
$query = "mysql_query('INSERT INTO bugs (id, reporter, title, desc) VALUES ('', '$username', '$title', '$desc')') or die('Could not insert data because '.mysql_error())";
echo "Sent...";
?>
I get the "Sent..." output but no error and the info has not been inserted.
table structure
************************************** 1. row ***********************************
Table: bugs
Create Table: CREATE TABLE 'bugs' (
'id' int(32) NOT NULL AUTO_INCREMENT,
'reporter' varchar(32) COLLATE utf8_unicode_ci NOT NULL,
'title' varchar(32) COLLATE utf8_unicode_ci NOT NULL,
'dec' varchar(32) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY ('id')
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
1 row in set (0.00)