simple php table loop


Posted on 16th Feb 2014 07:03 pm by admin

Hi all,

I've the following code

<?php // Create category options
$query = "SELECT * FROM categories ORDER BY category ASC";
$result = mysql_query ($query);
while ($row = mysql_fetch_array ($result, MYSQL_NUM)) {
echo "<input type="checkbox" name="types[]" value="$row[1]">$row[1]n";
}
?>

This lists out up to 15 checkboxes, but can increase or decrease if more are added/removed. At present this simply produces a list.
How can I alter the above to produce a nice table with say 5 checkboxes per row?

No comments posted yet

Your Answer:

Login to answer
207 Like 5 Dislike
Previous forums Next forums
Other forums

article site help remaining text
Hi all hope you will be fine
I am creating a article site in this site i want to put some text on

Multi Level Array Problem
hi all,

For example I have array like below:

$temp = array(array('north america', 'us'

how do i make a string??
hey guys,
can someone please tell me how to put data from the glob function into a string

MSSQL/PHP
I am tryint to setup a webapplication developed in PHP, Apache2.0 and SQLServer2000 as backend which

send message to the java application
Oracle 10g with Windows platform.

I have a java application that periodically pings the d

foreach loop, assistance request
I would like some guidance on the usage of foreach as I try to parse through a large database and wh

How to update this array?
I am saving a string that looks this: username1, username2, username3...
into a single cell in a

please help me in this update statment
hi every one

if I have table and this data in it

id name
10

Sufficient protection from bad input?
I am writing a simple script to let people upload 'pages' of their own content, be it simply a few b

multipart emiail forms
Hi All,

I am new to the boards and I've been working on a form (which is rather massive, imo

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash