insert data to mysql php code example
Example 1: insert php code
<?php
$host = "localhost";
$username = "username";
$pass = "";
$db="furniture";
$conn=mysqli_connect($host,$username,$pass,$db);
if(!$conn){
die("Data connection error");
}
?>
Example 2: how to insert data in mysql using oop php
--
-- Table structure for table `tbl_posts`
--
CREATE TABLE IF NOT EXISTS `tbl_posts` (
`post_id` int(11) NOT NULL AUTO_INCREMENT,
`post_title` varchar(150) NOT NULL,
`post_desc` text NOT NULL,
PRIMARY KEY (`post_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
--
-- Dumping data for table `tbl_posts`
--