Priyo
02-07-2012, 08:18 AM
Everything looks alright, but unable to find out this error message line -
When I try to run this it shows the following error -
Fatal error: Function name must be a string in ../form1.php on line 33
<?php
define('DB_NAME', 'colors_inc');
define('DB_USER', 'root');
define('DB_PASSWORD', '******');
define('DB_HOST', 'localhost');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected) {
die('Can\'t use' . DB_NAME. ': ' . mysql_error());
}
$Name = $_POST['Customer_Name'];
$Address = $_POST['Home_Address'];
$Contact = $_POST['Contact_Number'];
$Land = $_POST['Land_Phone_Number'];
$Sex = $_POST['Sex'];
/*$Type = $_POST['Product_Type'];
$Model = $_POST['Product_Model_Number'];
$Payment = $_POST['Payable_Amount'];*/
$sql = "INSERT INTO Customer (Customer_Name, Home_Address, Contact_Number, Land_Phone_Number, Sex) VALUES ('$Name','$Address', '$Contact', '$Land', '$Sex')";
if (!$mysql_query($sql)) {
die('Error' . mysql_error());
}
mysql_close();
?>
Line 33 is this -
if (!$mysql_query($sql)) {
Can anyone please help?
When I try to run this it shows the following error -
Fatal error: Function name must be a string in ../form1.php on line 33
<?php
define('DB_NAME', 'colors_inc');
define('DB_USER', 'root');
define('DB_PASSWORD', '******');
define('DB_HOST', 'localhost');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if (!$db_selected) {
die('Can\'t use' . DB_NAME. ': ' . mysql_error());
}
$Name = $_POST['Customer_Name'];
$Address = $_POST['Home_Address'];
$Contact = $_POST['Contact_Number'];
$Land = $_POST['Land_Phone_Number'];
$Sex = $_POST['Sex'];
/*$Type = $_POST['Product_Type'];
$Model = $_POST['Product_Model_Number'];
$Payment = $_POST['Payable_Amount'];*/
$sql = "INSERT INTO Customer (Customer_Name, Home_Address, Contact_Number, Land_Phone_Number, Sex) VALUES ('$Name','$Address', '$Contact', '$Land', '$Sex')";
if (!$mysql_query($sql)) {
die('Error' . mysql_error());
}
mysql_close();
?>
Line 33 is this -
if (!$mysql_query($sql)) {
Can anyone please help?