私はこのエラーを解決しようと2時間を費やしましたので、最後に質問しました。未定義の変数mysql-php
私のテーブルには、私が指定したschemenameため収集フェイルドの値を取得しようとしているこの
tablename- schemeOverview
| slno |schemename | amount| date2 | date3 | date4 |collected |
|---------|-----------|-------|-------|-------|-------|----------|
| 1 | Cell | 1000 | DUE | DUE | | 0 |
| 2 | Cell | 1000 | PAID | PAID | | 0 |
| 3 | Cell | 1000 | DUE | DUE | DUE | 0 |
| 4 | Cell | 1000 | PAID | PAID | | 100 |
| 5 | Cell | 1000 | DUE | DUE | | 0 |
the table was created in phpmyadmin and the default value for collected is 0.
のようなものです。
ここにコード
echo "$scheme_name";
$sql12 = " SELECT collected FROM schemeOverview WHERE schemename = '".$scheme_name."'";
$reslut12 = mysqli_query($conn,$sql12);
var_dump($result12);
if(!$result12)
{
echo "Error fetching data: " .mysqli_error($conn);
}
else{
echo "Success";
}
while ($row12 = $result12->fetch_assoc())
{
var_dump($row12);
}
これは、それは、単純なタイプミス(ULは結果に、逆転されて)私は
sapneshad
Notice: Undefined variable: result12 in E:\xampp\htdocs\insertPayment.php on line 195
NULL
Notice: Undefined variable: result12 in E:\xampp\htdocs\insertPayment.php on line 196
Error fetching data :
Notice: Undefined variable: result12 in E:\xampp\htdocs\insertPayment.php on line 203
Fatal error: Uncaught Error: Call to a member function fetch_assoc() on null in E:\xampp\htdocs\insertPayment.php:203 Stack trace: #0 {main} thrown in E:\xampp\htdocs\insertPayment.php on line 203