hey all, i need some help. im just learning how to work with INSERT statements, so i need a few pointers. first off, i have a really big table that i want to fill with info from a web form. i think its got like 37 fields or something close to that. so this is just a little snipit of what ive got so far:
<?
// make a random number for an account number
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$randval = rand();
$id = $randval;
// database stuff
$db = mysql_connect("server", "user", "pass");
mysql_select_db("video",$db);
$sql = "INSERT INTO subscribers (account,fullname,address,city,state,zip) VALUES ('$id','$fullname','$address','$city','$state','$zip')";
$result = mysql_query($sql);
echo "Done!";
?>
ok, now this worked the first time i did it. everything went into the database ok. now when i try and do it, it doesnt work. it doesnt do anything.. anybody know why ?
my second question has to do with a specific part of the code in questionm and my large number of fields.
$sql = "INSERT INTO subscribers (account,fullname,address,city,state,zip) VALUES ('$id','$fullname','$address','$city','$state','$zip')";
if i am to follow that style of having the data entered, i would have to make a huge string of like 70 variables to get everything into the right place, and it would be really hard to keep track or it and make modifications to it.
so whats a better way ? can i break it up into several querys ? any suggestions, corrections, and help welcome.