使用SELECT函数时,mysql不会全部选择

My code looks like this:

$sql = "SELECT `sw1`, `sw2`, `sw3`, `sw4`, `fb1`, `fb2`, `fb3`, `fb4`, `bew1`, `bew2`, `bew3`, `bew4` FROM `reg` WHERE `id` = ".$id." ORDER BY `id` ASC LIMIT 0, 30 ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        foreach($row as $x => $x_value) {
             echo "Key=" . $x . ", Value=" . $x_value;
             echo "<br>";
        }
    }
}

There is some data in sw2 but it isn't shown.
When I tryed to UPDATE data the data in the db wasn't changed.
$id is right.
other data from the table could be read.

This code works fine:

$sql = "SELECT * FROM `reg` WHERE `id` = ".$id." ORDER BY `id` ASC LIMIT 0, 30 ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();
    print_r($row);
}

Try your query with echo. same trouble follows try changing Where 'id' = "$id" to Where 'id' like "$id"

You dont need quotes:

$sql = "SELECT sw1, sw2, sw3, sw4, fb1, fb2, fb3, fb4, 
bew1, bew2, bew3, bew4 
FROM reg WHERE id = $id";