Archive

Posts Tagged ‘php’

PHP – MySQL Insert

January 16, 2014 1 comment

After long wait I got my hands dirty with PHP and MySQL.

$dbServer = 'localhost';
$dbUserName = 'username';
$dbPassword = 'password';
$connection = mysql_connect($dbServer, $dbUserName, $dbPassword);
if(!$connection) {
		  die('Connection Failed : ' . mysql_error());
}

$insertStatement = 'INSERT INTO TableName(Column) VALUES("Value")';
mysql_select_db('databaseName');
$returnValue = mysql_query( $insertStatement, $connection );
if(!$returnValue){
		  die('Insertion Failed : ' . mysql_error());
}
echo "Data Inserted.";
mysql_close($conn);

Categories: Misc Tags: ,