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

mySQL and PHP search
Hello,
I am trying to code a project and ran into a brick wall with one of my pages. I am pretty

mysql query with single quotes in a variable
$sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('$u

MASS PM
Hello all, I'm trying to send mass private messages to users in my database but keep getting an erro

Switch letters in message (basic cryptology)...
I am trying to switch letters around in a message for an application on my site (see here). The prob

Need help making a blockquote and line items conditional
I have some code I bought a few years ago that allows my clients to update content on their site usi

What's best way to get a user's Word doc converted to simple html and images?
Hi all,

I was just wondering if anybody has any experience of this.
Basically, I'm buildin

NOOB needs help with upload file
The intent of this form is to create a folder for a client and upload an image into another folder '

Supress some serveroutput but not all
Hi,

I have a script I'm working on that uses plsql to create and RMAN script, this uses d

Accept only alpha characters
I've got this bit of code ready for accepting a phrase:

Code: if (!eregi ("", $_POS

Values disappear from my array :( HELP!
hey all, I have a lil mysql/php/apache script that queries a database
and pulls put 5 integers.

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