私はこの奇妙なバグを自分のPHPコードで困惑しているので、ここの誰かが私を助けてくれることを願っています。PHPが偽でコードの特定の行を実行していると思われる場合
//STEP 1b - PREPROCESSING OF SUBMITTED FORM DATA (table level)
while($count_table++ != $num_tables && $submit != ""){
$table_show[$count_table] = mysql_escape_string($_POST[table_show_.$count_table]);
$ne_page[$count_table] = mysql_escape_string($_POST[ne_page_.$count_table]);
}
//STEP 2 - SUBMITTED?
if($submit!=""){
//The form has been submitted
//STEP 3 - VALIDATION
//Reset counts
$count_column = 0;
$count_table = 0;
//Check for empty fields
while($count_table++ != $num_tables){ if($table_show[$count_table] != ""){ //While there are tables, validate only if they are in included in NexEdit
このシナリオでは、私は、返品の場合はfalse値をテストしてる場合は、次のとおりです。 まず、ここでのコードの関連部分です。結果として、それはちょうどそれの前に真っ直ぐに戻って行くべきです(私はしばらくすると、同じポイントでさらに後)。
if($ne_page[$count_table] == ""){
$error = "You forgot to give a NexEdit name to one or more of the tables you want to include in NexEdit.";
}
echo "Debug";
期待どおり、これは決してエコーされません。
while($db_field[++$count_column]){ //Stay inside the loop until we run out of db fields
if($db_field[$count_column] == "" || $db_type[$count_column] == "" || $db_table[$count_column] == "" || $ne_name[$count_column] == "" || $ne_type[$count_column] == "" || $ne_order[$count_column] == ""){ //Check if all information is entered if the column is selected to be included in NexEdit
$error = "You didn't enter all required information. Required fields are indicated with (*).";
バグが発生した場所です:以前(デバッグエコーで示されたように)で、それはまだここで$誤差の値を設定した場合、PHPは入っていないはずにもかかわらず。
}
}
}}
//More code...
私は何が欠けていますか?私はこれを数時間見ていて、友人の開発者に援助を依頼しましたが、私が間違ったことを見つけることはできません。
1ブロック内のすべてのコード:
//STEP 1b - PREPROCESSING OF SUBMITTED FORM DATA (table level)
while($count_table++ != $num_tables && $submit != ""){
$table_show[$count_table] = mysql_escape_string($_POST[table_show_.$count_table]);
$ne_page[$count_table] = mysql_escape_string($_POST[ne_page_.$count_table]);
}
//STEP 2 - SUBMITTED?
if($submit!=""){
//The form has been submitted
//STEP 3 - VALIDATION
//Reset counts
$count_column = 0;
$count_table = 0;
//Check for empty fields
while($count_table++ != $num_tables){ if($table_show[$count_table] != ""){ //While there are tables, validate only if they are in included in NexEdit
if($ne_page[$count_table] == ""){
$error = "You forgot to give a NexEdit name to one or more of the tables you want to include in NexEdit.";
}
echo "Debug";
while($db_field[++$count_column]){ //Stay inside the loop until we run out of db fields
if($db_field[$count_column] == "" || $db_type[$count_column] == "" || $db_table[$count_column] == "" || $ne_name[$count_column] == "" || $ne_type[$count_column] == "" || $ne_order[$count_column] == ""){ //Check if all information is entered if the column is selected to be included in NexEdit
$error = "You didn't enter all required information. Required fields are indicated with (*).";
}
}
}}
//More code...
!= ""の代わりに空文字列またはis_nullを使用し、他のチェックでは!==を使用して開始するのはなぜですか。それはより効果的にデバッグするのに役立ちます。男、正に、私はここで何が起こっているのかは分かりません。関連するすべてのコードを1つのブロックに入れることができますか?文脈なしであなたを助けるのは難しい。 –
また、 'var_dump()'にチェックを入れて評価するものを見ることもできます。たとえば、 'var_dump($ ne_page [$ count_table] ==" ");'は真または偽を出力します。 – Treffynnon
元の投稿の1つのブロックにコード全体を追加しました。私もあなたの提案を試してみるだろうし、できるだけ早くあなたに報告します。 – DriesOeyen