What am I doing wrong with this code?
<?php
/*
* Following code will create a new product row
* All product details are read from HTTP Post Request
*/
mysql_select_db("dataparkir");
$con = mysql_connect("localhost","root","") or die("error connection");
if($con)
{
echo "connection success";
}
// check for required fields
$lantai = $_POST['lantai'];
$waktu_masuk = $_POST['waktu_masuk'];
$waktu_keluar= $_POST['waktu_keluar'];
$id_user = $_POST['id_user'];
$qr_code = $_POST['qr_code'];
//echo "input data: " . $lantai." ".$waktu_masuk." ".$waktu_keluar." ".$id_user." ".$qr_code." ";
// mysql inserting a new row
$result = mysql_query($con,"INSERT INTO transaksi (lantai, waktu_masuk, waktu_keluar, id_user, qr_code) VALUES($lantai, $waktu_masuk, $waktu_keluar, $id_user,'$qr_code')");
// check if row inserted or not
if ($result) {
echo mysql_insert_id();
} else {
echo '0';
}
?>
Because yesterday, I was running this code and all fine, but this morning, I run this code and i got "connectionsuccess0" on my code, which means it isn’t do $result, why is that?
table schema :
1 id_transaksi int(11)
2 waktu_masuk int(11)
3 waktu_keluar int(11)
4 lantai varchar(40)
5 tempat_parkir varchar(40)
6 qr_code varchar(40)
7 id_user int(11)