You are doing three things wrong, at first you are not actually setting the $ category to anything — only the values of the two undefined values, which are zero by default. So you get an array like:
array('category_id' => null, 'name' => null)
-, $category_id $category_name, . , , , . , .
. , PHP , ..
$query = "SELECT * FROM categories ORDER BY name ASC";
$result = $db->query($query);
$categories=array();
while ($row = $result->fetch_array()){
$categories[] = array('category_id' => $row['category_id'], 'category_name' => $row['name']);
}
, :
foreach ( $categories as $category ) {
?>
<input type='radio' value='<?php echo $category['category_id']; ?>' name='category[]'><?php echo $category['category_name']; ?>
<?php
}
, , .