[問題] $_SESSION["id"]變數寫不進資料庫~
請教板上大大
我在嘗試將$_SESSION["id"]變數寫進資料庫的時候
執行時一直顯示錯誤
程式碼如下:
檔案一:檢查登入的php檔
<?
session_start();
include( "config.php" );
$qry = "select * from utilisateurs where uid='$uid' and mot_cle='$mot_cle';";
$result = mysql_query($qry);
if ( mysql_num_rows($result) >0 )
{
$_SESSION["id"] = $uid;
$_SESSION["pass"] = $mot_cle;
$_SESSION["ok"]=1;
}
?>
檔案二:將變數寫進資料庫的檔案
$query = " insert into demande_eleves(uid, folie, solde)
values('$SESSION_["id"]', $foucault, $solde);";
但這樣執行出來會顯示錯誤:
Parse error: syntax error, unexpected '"',
expecting T_STRING or T_VARIABLE or T_NUM_STRING
如果我將$query那句藍色部分換成$uid就不會顯示錯誤
但會顯示寫入資料庫失敗XD
想請大家幫忙看看,是否在編碼語法上有什麼問題呢?
先謝謝各位大大!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.24.71.156
推
07/17 01:02, , 1F
07/17 01:02, 1F
推
07/17 01:56, , 2F
07/17 01:56, 2F
→
07/17 04:29, , 3F
07/17 04:29, 3F
→
07/17 04:35, , 4F
07/17 04:35, 4F
→
07/17 12:53, , 5F
07/17 12:53, 5F
→
07/17 20:26, , 6F
07/17 20:26, 6F