$con = mysql_connect("localhost","root","");
if (!$con) die('Could not connect: ' . mysql_error());
mysql_select_db("pilot", $con);
$sql = "INSERT INTO logs (id, userid, date, plane, from, to, blocksoff, takeoff,
landing, blockson, flighttime, traveltime, tachobefore, tachoafter, tacho,
hobbsbefore, hobbsafter, hobbs, landings) VALUES ('$nfid', '$nfuserid',
'$nfdate', '$nfplane', '$nffrom', '$nfto', '$nfblocksoff', '$nftakeoff',
'$nflanding', '$nfblockson', '$nfflighttime', '$nftraveltime', '$nftachobefore',
'$nftachoafter', '$nftacho', '$nfhobbsbefore', '$nfhobbsafter', '$nfhobbs',
'$nflandings')";
mysql_query($sql);
沒有什麼不妥的$ sql中,好像它只是不會查詢.. :(任何人都知道爲什麼這個MYSQL INSERT不起作用?
id|userid=int(11)
date=date
plane|from|to=text
blocksoff|takeoff|landing|blockson=time
flighttime|traveltime|tachobefore|tachoafter|tacho|hobbsbefore|hobbsafter|hobbs|landings=double
所有的變量都來自一個文本框(如果它的事項)在$
打印$ sql並粘貼在這裏! –
嘗試回顯'$ sql'並手動運行它。還可以嘗試查詢'mysql_query($ sql);'到'mysql_query($ sql)或者死(mysql_error());' –
P.S.不鼓勵使用'mysql_ *'。 http://www.php.net/manual/en/function.mysql-query.php –