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

A problem with my GD class
Hello,

I created a nice (and simple for now) GD class.
The problem is , it works great on

Working with Dates, help.
Sooo to make a long story short, here's what im trying to accomplish.

I need to create a drop

pagination numbering pattern
Hello,

I have following code which works great for pagination. but i have small issue now.

Update Database
Hi All,


I have a problem with this:

Code: [Select]<?php
session_start();

session variables not working anymore
hello,
i use sessions to handle authentication within my site. my host has been changing a lot of

How to sum these output values
Hi

I need sum the month totals
SELECT region_name, area_name ,SUM (CASE WHEN S

Preloading images
Posting this question here because I am not sure where this should belong.I am building an asp.net a

Error querying database.
I get the above error when trying to insert some values to a datatable.
Here's the code :

Upload file!
Ok i have a form..
Code: <form name="form1" method="post" action=&quo

Querying info from one table based on info in another
Hi, I am currently trying to make a part for my user driven website where one user can subscribe to

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