0

データベースにデータを挿入するフォームがあります。フィールドの 1 つはweDate

$weDate=date('Y-m-d',strtotime('Friday'))

以下を使用する場合:

$sql = mysql_query("SELECT ID as 'DB_ID', 
                         partnumber as 'Part_Number', 
                         pndesc as 'Part Number Description', 
                         name as 'Name', 
                         reason as 'Reason', 
                         comment as 'Comments', 
                         date as 'Date', 
                         time as 'Time', 
                         weDate as 'Weekend Date' 
                    FROM $table 
                    WHERE weDate = '2013-05-03'");

結果が返ってきます。

私がしようとすると:

$sql = mysql_query("SELECT ID as 'DB_ID', 
                         partnumber as 'Part_Number', 
                         pndesc as 'Part Number Description', 
                         name as 'Name', 
                         reason as 'Reason', 
                         comment as 'Comments', 
                         date as 'Date', 
                         time as 'Time', 
                         weDate as 'Weekend Date'
                    FROM $table 
                    WHERE weDate = '$weDate2'");

何も返ってきません。なんで?

PHP 変数は次のとおりです。

$weDate2 = date('Y-m-d', strtotime('-1 weeks Friday')
4

1 に答える 1