I have this script that takes a variable and puts it into a table. My connect.php file is correct and selects the right database, but for some reason this data will not insert. It says it succeeds but nothing gets put in the table
My Script
if(!empty($_POST['phrase'])){
$phrase = $_POST['phrase'];
$phrase = mysql_real_escape_string($phrase);
$phrase = preg_replace("/[^A-Za-z ]/", "", $phrase);
$query5 = mysql_query('SELECT phrase FROM dictionary WHERE phrase = "'.$phrase.'" '); // Check the database
if(mysql_num_rows($query5)>0){
null;
}else{
echo $phrase;
$query10 = "INSERT into dictionary(adjective, noun, phrase, subject, verb) values(NULL, NULL, '$phrase', NULL, NULL)";
$result = mysqli_query($query10);
echo "<pre>Debug: $query10</pre>\m";
//$result = mysqli_query($con, $query);
if ( false===$result ) {
printf("error: %s
");
}
else {
echo 'done.';
}
mysqli_close();
}
//Debugging Purpose
echo '<span class="error" > -'. $phrase .'</span>';
}
It echos 'done.' but the table doesn't update
here is how my table is setup
-- Database: `dictionary`
--
CREATE DATABASE IF NOT EXISTS `dictionary` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `dictionary`;
-- --------------------------------------------------------
--
-- Table structure for table `adjective`
--
CREATE TABLE IF NOT EXISTS `adjective` (
`id` int(10) NOT NULL,
`adjective` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `adjective`
--
INSERT INTO `adjective` (`id`, `adjective`) VALUES
(1, 'orange'),
(2, 'blue');
-- --------------------------------------------------------
--
-- Table structure for table `noun`
--
CREATE TABLE IF NOT EXISTS `noun` (
`id` int(10) NOT NULL,
`noun` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `noun`
--
INSERT INTO `noun` (`id`, `noun`) VALUES
(1, 'tamaleh');
-- --------------------------------------------------------
--
-- Table structure for table `phrase`
--
CREATE TABLE IF NOT EXISTS `phrase` (
`id` int(10) NOT NULL,
`phrase` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `phrase`
--
INSERT INTO `phrase` (`id`, `phrase`) VALUES
(0, 'Hello There'),
(1, 'Hello World');
-- --------------------------------------------------------
--
-- Table structure for table `subject`
--
CREATE TABLE IF NOT EXISTS `subject` (
`id` int(10) NOT NULL,
`subject` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `subject`
--
INSERT INTO `subject` (`id`, `subject`) VALUES
(1, 'I'),
(2, 'The');
-- --------------------------------------------------------
--
-- Table structure for table `verb`
--
CREATE TABLE IF NOT EXISTS `verb` (
`id` int(10) NOT NULL,
`verb` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `verb`
--
INSERT INTO `verb` (`id`, `verb`) VALUES
(1, 'jumping');