Not sure what I'm doing wrong. What does it mean by "No database selected" My code is telling what database to insert data to.
It's spelled correctly.
Here's the code...
<?php
$con = mysql_connect("localhost","admin","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$DatabaseName = 'mypatterns';
mysql_select_db($DatabaseName, $con);
$PatternId=!isset($_POST['PatternId']);
$PatternNo=!isset($_POST['PatternNo']);
$Company=!isset($_POST['Company']);
$Type=!isset($_POST['Type']);
$Description=!isset($_POST['Description']);
$sql="INSERT INTO patterns (PatternId, PatternNo, Company, Type, Description)
VALUES
($PatternId,$PatternNo,$Company,$Type,'$Description')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
Thank you in advance for any help provided, it's greatly appreciated.
It's spelled correctly.
Here's the code...
<?php
$con = mysql_connect("localhost","admin","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$DatabaseName = 'mypatterns';
mysql_select_db($DatabaseName, $con);
$PatternId=!isset($_POST['PatternId']);
$PatternNo=!isset($_POST['PatternNo']);
$Company=!isset($_POST['Company']);
$Type=!isset($_POST['Type']);
$Description=!isset($_POST['Description']);
$sql="INSERT INTO patterns (PatternId, PatternNo, Company, Type, Description)
VALUES
($PatternId,$PatternNo,$Company,$Type,'$Description')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>
Thank you in advance for any help provided, it's greatly appreciated.