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

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

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

Calling a Procedure with IN & OUT Parameters
Hello,

I usually call my procedures using the following way

declare variable e

Cant display mysql data
Hey all,

I am learning php and my first goal is to create a simple CMS. At the moment I am st

Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the

why preg_match_all does not return the number of matches
My regex looks like

X[^x{4e00}-x{9fa5}]*Y

(where X and Y are two Chinese characters)

Check Digits and extracting digits
I think I can figure out the code for this but I am having a very hard time getting past the first s

Deleting pointers froms vector?
Hi. I have a vector filled with pointers and I want to delete the pointers. I could do a loop and do

$variable $variables type question
I need to be able to designate an array element dynamically, so I thought to use a variable variable

Quick Question about echo value
Hey guys, I'm trying to get something to show differently in one of my scripts. I'm trying to make

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