Can not seem to be able to group all entries of the same group on the same row

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_…>

something-user
_____________guys-name
_________________________555-555-5555
______________________________________email@email.com

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
$token_check=NULL;
$token=NULL;
for ( $count = 0; $count <= 19; $count ++) {
for ( $counter = 0; $counter < 20; $counter ++) {
$rand = rand ( 1, 62);
$token[$count]=$token[$count].$tokenkey[$rand];
}
}
//$token array has 19 strings in it
$array=array(username,password,firstname,lastname,address,city,state,country,zipcode,sitename,options,verified,approved,geosignup,geologon,optionsnew,geooptionsnew,summaryledger,couponcode,websitehtml);

$con=mysql_connect($host,$user,$password);
@mysql_select_db($database, $con) or die( “Unable to select database”);
@mysql_query(“CREATE TABLE users (id MEDIUMINT NOT NULL AUTO_INCREMENT,UNIQUE KEY(id),
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,
city 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
) ENGINE=MyISAM”);

//makes all the columns nicely…

//entering all the 19 strings into the data base “users”…

$cnt=0;
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]’)”);
}
$cnt++;
}
unset($var);

//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…

Thanks :slight_smile: