I am trying to group all the entries for one username to retrieve all of the columns in that same group. Example a user name will be entered along several other parts of data like name phone number email, things like that. But it puts all the data into the data base like a stair step leading down and increments every following column to the next row, since they are not all grouped on the same row I can't get but the first entry, the user name which is what I already know... How in the world is this done right, I can't figure this out!

Here is what I tried and it does just what I just described, looking at the data in phpmysql it looks like this:

___column 1____column 2_____column 3______column 4____.............>


So it does not work right, here is the php script I tried that did this type of result:

include_once '../common/config.php'; //$tokenkey arrary and other strings for user, password, database for mysql conect
for ( $count = 0; $count <= 19; $count ++) {
for ( $counter = 0; $counter < 20; $counter ++) {
$rand = rand ( 1, 62);
//$token array has 19 strings in it

@mysql_select_db($database, $con) or die( "Unable to select database");
username VARCHAR(50) NOT NULL,
password VARCHAR(50) NOT NULL,
firstname VARCHAR(50) NOT NULL,
lastname VARCHAR(50) NOT NULL,
address VARCHAR(100) NOT NULL,
state VARCHAR(100) NOT NULL,
country VARCHAR(100) NOT NULL,
zipcode VARCHAR(100) NOT NULL,
sitename VARCHAR(50) NOT NULL,
options VARCHAR(300) NOT NULL,
verified VARCHAR(10) NOT NULL,
approved VARCHAR(10) NOT NULL,
geosignup VARCHAR(2000) NOT NULL,
geologon VARCHAR(2000) NOT NULL,
optionsnew VARCHAR(10) NOT NULL,
geooptionsnew VARCHAR(300) NOT NULL,
summaryledger VARCHAR(300) NOT NULL,
couponcode VARCHAR(20) NOT NULL,
websitehtml VARCHAR(5000) NOT NULL

//makes all the columns nicely...

//entering all the 19 strings into the data base "users"...

foreach ($array as &$var) {
if($cnt == 0 || $cnt == 1 || $cnt == 2 || $cnt == 3 || $cnt == 9 ||$cnt == 11 || $cnt == 12 || $cnt == 15 || $cnt == 18) {
@mysql_query("INSERT INTO users (".$var.") VALUES ('$token[$cnt]')");
if($cnt >= 4 && $cnt <= 8) {
@mysql_query("INSERT INTO users (".$var.") VALUES ('$token[$cnt]')");
if($cnt == 10 || $cnt == 16 || $cnt == 17) {
@mysql_query("INSERT INTO users (".$var.") VALUES ('$token[$cnt]')");
If($cnt == 13 || $cnt == 14) {
@mysql_query("INSERT INTO users (".$var.") VALUES ('$token[$cnt]')");
if($cnt == 19) {
@mysql_query("INSERT INTO users (".$var.") VALUES ('$token[$cnt]')");

//now it is that big mess I talked about!!

Something I am doing is very wrong, please tell me how this should be done. Tring to figure it out from the manual is getting me no place but more confussed..