<?php include "functions.php";

	$nalog=getTBLNalog($_POST[3]);
	$kilometrina=$nalog['kilometrina'];
	$cena=$kilometrina*$_POST[2];

	//$con = mysql_connect('localhost', 'root', '');
	$con = mysql_connect('localhost', 'pcpomoc_potni', 'boroko');
	if (!$con){
			echo('Could not connect: ' . mysql_error());
	}
	//mysql_select_db("potni_stroski", $con);
	mysql_select_db("pcpomoc_potni", $con);
	mysql_query("SET NAMES 'utf8'") or die(mysql_error());
	mysql_query("SET lc_time_names = 'sl_SI'") or die(mysql_error());
	mysql_query("INSERT INTO nalog (datum, pot, km, cena, serija) VALUES('$_POST[0]', '$_POST[1]', '$_POST[2]','$cena','$_POST[3]')") or die(mysql_error());
	mysql_close($con);
	
	setTBLNalog($_POST[3]); //nastavi nove podatke
	
	echo $kilometrina."*".$_POST[2]."=".$cena;
	
?>