I have a form that takes two values as input and parses them using post method to the next file where I have this piece of code. This should save the two values in the MySQL database. But strangely it doesn't .. and in the output error I get is this: 0: 0:
$service_name = $_POST['service_name'];
$service_price = $_POST['service_price'];
$link = mysql_connect("localhost", "db_user", "pa$$");
mysql_select_db("database", $link);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
mysql_select_db("database", $link);
mysql_query("INSERT INTO service_tbl(id_service, service_name, service_price) VALUES(NULL,'$service_name','$service_price')", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
In my database table service_tbl
, id_service
is auto_increment and the other two columns are VARCHAR. What am I doing wrong here?