1

"tbl_name,itime_end,itime_start"タイムスタンプで特定の日付より上のみを選択するコードは次の とおりです。

$reponse = $bdd->query('
SELECT 
tbl_name,
itime_end,
itime_start 
FROM table_ref 
WHERE `itime_start` > ".$Timestamp_UserStartDate." 
')

itime_start$Timestamp_UserStartDateタイムスタンプにある

しかし、gettype を実行する$timestamp_USerStartDateと、整数で$itime_start文字列になります。Anecho $timestamp_USerStartDate;は :1365408000 を与え、 An はecho $donnees['itime_start'];: 1364998028...を与えます

その結果、選択したすべてのデータがフィルタリングされずに表示されます。アドバイスありがとうございます!

4

2 に答える 2

1

まず、実際に行っている方法で変数を注入するべきではありません。変数プレースホルダーをバインドしてから、後で設定する必要があります。ただし、コードの問題は、意図した方法で単一括弧を終了していないことです。下の行を試してください

$reponse = $bdd->query('SELECT tbl_name,itime_end,itime_start FROM table_ref WHERE `itime_start` > "'.$Timestamp_UserStartDate.'" ')
于 2013-04-11T14:56:36.643 に答える