MYSQLI_ASSOC and MYSQLI_NUM
// mysqli_fetch_array($query) [General and simple Process]
while ($row = mysqli_fetch_array($query)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
// MYSQLI_ASSOC [index names will be same as user defined]
while ($row = mysqli_fetch_array($query,MYSQLI_ASSOC)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
// MYSQLI_NUM [index names will be change as 0 , 1 , 2 , 3 , n ]
while ($row = mysqli_fetch_array($query,MYSQLI_NUM)) {
?>
<tr>
<td><?php echo $row['0']; ?></td>
<td><?php echo $row['1']; ?></td>
<td><?php echo $row['2']; ?></td>
<td><?php echo $row['3']; ?></td>
</tr>
<?php
}
// mysqli_fetch_assoc($query) [index names will be same as user defined]
while ($row = mysqli_fetch_assoc($query)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
while ($row = mysqli_fetch_array($query)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
// MYSQLI_ASSOC [index names will be same as user defined]
while ($row = mysqli_fetch_array($query,MYSQLI_ASSOC)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
// MYSQLI_NUM [index names will be change as 0 , 1 , 2 , 3 , n ]
while ($row = mysqli_fetch_array($query,MYSQLI_NUM)) {
?>
<tr>
<td><?php echo $row['0']; ?></td>
<td><?php echo $row['1']; ?></td>
<td><?php echo $row['2']; ?></td>
<td><?php echo $row['3']; ?></td>
</tr>
<?php
}
// mysqli_fetch_assoc($query) [index names will be same as user defined]
while ($row = mysqli_fetch_assoc($query)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['roll']; ?></td>
<td><?php echo $row['created_date']; ?></td>
</tr>
<?php
}
Comments
Post a Comment