below code gives me error in line 8.

1. i had paymentform.php
where i entered data.

2. below is paymentinsert.php where i am getting error in line 8.

Fatal error: Function name must be a string in /home/content/59/8390659/html/COUPONDISCOUNTS/php/MySQL/paymentinsert.php on line 8

@mysql_select_db($database) or die( "Unable to select database");
$query = "INSERT INTO payment VALUES ('$amount','$description','$sender')";

    if(1 === mysql_affected_rows()){
        echo 'insert passed';
        $to = "hhh@email.com";
        $subject = "New Cowboy!";
        $body = "Your data was inserted into the DB correctly!";
        if (mail($to, $subject, $body)) {
           echo("<p>Message successfully sent!</p>");
        } else {
        echo("<p>Message delivery failed...</p>");
    echo 'insert failed';

Pls advise.


Remove the $ in front of mysql_connect.

Another question, when record is inserted i want paymentID is incremented by 1 automatically. I have the table as below. How can i change the code below so when record is inserted into the table, paymentID gets incremented by 1.

i guess i have to add primary key and auto increment?

paymentID int,
amount int,
description varchar( 100 ) ,
Sender varchar( 50 )


i was able to add pk and auto increment.

First i set autoincrement to 500
then inserted some values up to 504. it worked.

then i reset auto increment to 14, but it does not work. it still increments from 505.

How can i drop any values from 500 and start increment from 14? do i have to drop old auto_increment first? not sure.