Results 1 to 3 of 3

Thread: Fatal error: Function name must be a string

  1. #1
    Join Date
    Feb 2012
    Location
    Dhaka, Bangladesh
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Fatal error: Function name must be a string

    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

    Code:
    <?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 -
    Code:
    if (!$mysql_query($sql)) {
    Can anyone please help?
    Last edited by Priyo; 02-07-2012 at 07:13 PM.

  2. #2
    Join Date
    Jul 2010
    Location
    Minnesota
    Posts
    256
    Thanks
    1
    Thanked 21 Times in 21 Posts

    Default

    Get rid of the $ on line 33

  3. The Following User Says Thank You to fastsol1 For This Useful Post:

    Priyo (02-07-2012)

  4. #3
    Join Date
    Feb 2012
    Location
    Dhaka, Bangladesh
    Posts
    8
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by fastsol1 View Post
    Get rid of the $ on line 33
    Thank you so much! It worked. [Now I feel like a complete stupid to have missed that $ sign]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •