PHP, MySQL: can't explain this undefined index error

前端 未结 1 1464
鱼传尺愫
鱼传尺愫 2021-01-28 16:09

I\'m getting an undefined index error with this code:

// Select all bookings
$sql = \"SELECT * FROM booking\";

$result = mysqli_query($con,$sql);

echo \"

        
1条回答
  •  梦毁少年i
    2021-01-28 16:27

    Put a piece of debug code into your script to proove that the name is correct:-

    // Select all bookings
    $sql = "SELECT * FROM booking";
    
    $result = mysqli_query($con,$sql);
    
    echo "

    "; while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { print_r( $row ); // debug code // echo $row['custName'] . " - " . $row['roomNb'] . " - " . $row['date']; echo $row['custName']; }

    0 讨论(0)
提交回复
热议问题