And how does the actual insert php code look like ?
The unique key on SubscriberID will only allow one insertion with SubscriberID = 0;
And how does the actual insert php code look like ?
The unique key on SubscriberID will only allow one insertion with SubscriberID = 0;
CREATE TABLE subscribers
(
SubscriberID
int(150) unsigned NOT NULL auto_increment,
name
text NOT NULL,
street
text NOT NULL,
city
text NOT NULL,
state
text NOT NULL,
zip
text NOT NULL,
phone1
text NOT NULL,
phone2
text NOT NULL,
email1
text NOT NULL,
email2
text NOT NULL,
rec1name
text NOT NULL,
rec1Street
text NOT NULL,
rec1City
text NOT NULL,
rec1State
text NOT NULL,
rec1Zip
text NOT NULL,
rec1HomeTel
text NOT NULL,
rec1CellTel
text NOT NULL,
rec1Email1
text NOT NULL,
rec1Email2
text NOT NULL,
rec1Fax
text NOT NULL,
rec1Pager
text NOT NULL,
rec1OCI
text NOT NULL,
rec2Name
text NOT NULL,
rec2Street
text NOT NULL,
rec2City
text NOT NULL,
rec2State
text NOT NULL,
rec2Zip
text NOT NULL,
rec2HomeTel
text NOT NULL,
rec2CellTel
text NOT NULL,
rec2Email1
text NOT NULL,
rec2Email2
text NOT NULL,
rec2Fax
text NOT NULL,
rec2Pager
text NOT NULL,
rec2OCI
text NOT NULL,
rec3Name
text NOT NULL,
rec3Street
text NOT NULL,
rec3City
text NOT NULL,
rec3State
text NOT NULL,
rec3Zip
text NOT NULL,
rec3HomeTel
text NOT NULL,
rec3CellTel
text NOT NULL,
rec3Email1
text NOT NULL,
rec3Email2
text NOT NULL,
rec3Fax
text NOT NULL,
rec3Pager
text NOT NULL,
rec3OCI
text NOT NULL,
prefContact1
text NOT NULL,
prefContact2
text NOT NULL,
prefBegTime
text NOT NULL,
prefEndTime
text NOT NULL,
noPrefTime
text NOT NULL,
directContact
text NOT NULL,
password
text NOT NULL,
amountSent
text NOT NULL,
agree
text NOT NULL,
PRIMARY KEY (SubscriberID
),
UNIQUE KEY SubscriberID
(SubscriberID
),
UNIQUE KEY id
(SubscriberID
),...
What does the INSERT query look like if you print it instead of executing it and redirecting to the next page ?
i wasn't able to echo it - i kept getting errors; i don't know the syntax that well...
i commented out /* $query=... all the way down...
what's the syntax ?
echo "$_GET['SubscriberID'];" ?
Hi,
just do something like:
<?PHP
$SubscriberID=$_GET['SubscriberID'];
echo "The ID is: ".$SubscriberID."<br>\n";
$query = <<< EOSQL
insert into Cars (SubscriberID,veh1Owner,veh1Make,veh1Model,
veh1Color,veh1Style,veh1License,veh1ODC,
veh1DecalID,veh2Owner,veh2DecalID,veh2Make,
veh2Model,veh2Color,veh2Style,veh2License,
veh2ODC,veh3Owner,veh3DecalID,veh3Make,
veh3Model,veh3Color,veh3Style,veh3License,
veh3ODC,field)
values ('$SubscriberID','$RegisteredOwner','...eld1')
EOSQL;
echo "Now comes the query:<br>".$query."<br>\n";
//mysql_query($query);
//header("Refresh: 0;url=http://www.safe-teen.net/thanks.htm");
?>
btw. you can do something like this to see if MySQL has problems with the query:
mysql_query(...) or die ("Error: ".mysql_error()."<br>\n");
it's not getting the variable:
The ID is:
Now comes the query:
insert into Cars (SubscriberID,veh1Owner,veh1Make,veh1Model,veh1Color,veh1Style,veh1License,veh1ODC,veh1DecalID,veh2Owner,veh2DecalID,veh2Make,veh2Model,veh2Color,veh2Style,veh2License,veh2ODC,veh3Owner,veh3DecalID,veh3Make,veh3Model,veh3Color,veh3Style,veh3License,veh3ODC,field) values ('','bab nall','AM General','94 sedan','Champagne','sedan','kdf514','fhdfjsdfjdfj','10507','','','Blank','','Blank','','','','','','Blank','','Blank','','','','field')
How does the actual redirect code of the first page look like (including the query). and the value of the ID.
it's passing it though:
$query="insert into subscribers (name,street,city,state,zip,phone1,phone2,email1,email2,rec1name,rec1Street,rec1City,rec1State,rec1Zip,rec1HomeTel,rec1CellTel,rec1Email1,rec1Email2,rec1Fax,rec1Pager,rec1OCI,rec2Name,rec2Street,rec2City,rec2State,rec2Zip,rec2HomeTel,rec2CellTel,rec2Email1,rec2Email2,rec2Fax,rec2Pager,rec2OCI,rec3Name,rec3Street,rec3City,rec3State,rec3Zip,rec3HomeTel,rec3CellTel,rec3Email1,rec3Email2,rec3Fax,rec3Pager,rec3OCI,prefContact1,prefContact2,prefBegTime,prefEndTime,noPrefTime,directContact,password,amountSent,agree) values ('".$Name."','...,'".$agree."')";
$make=fopen("form/forms/admin/data.dat","a");
$to_put="";
$to_put .= $Name."|".$Street...|".$agree."
";
mysql_query($query);
$SubscriberID=mysql_insert_id();
header("Refresh: 0;url=http://www.safe-teen.net/autoreg.htm?SubscriberID=".$SubscriberID);
Hi,
can you post both scripts so I can test them ?
It can't be a big problem
Hi,
try to change the redirect to
header("Location: [url]http://www.safe-teen.net/autoreg.htm?SubscriberID=[/url]".$SubscriberID);
[/PHP9
processAutoProcess.zip
but the variable was making it to the next page...
Hi,
one question, what php version is the server running ?
You might try to use $SubscriberID directly instead or $HTTP_GET_VARS['SubscriberID'] instead of using $_GET['SubscriberID'] ...
What do you get if you execute
print_r($_GET) or
print_r($HTTP_GET_VARS)
i tried $HTTP_GET already
my server is current...
print_r($_GET) gives me this:
Array ( )
on odd browser wouldn't have anything to do with this, would it? NetCaptor...?
i just took out all references to the SubscriberID field in the script and it still didn't write to the table, so i have a problem elsewhere...
could it be that it didn't work because the script was not on the same page as the link referred to?
autoreg.htm?SubscriberID=".$SubsciberID
whiile the script was tucked away on autoprocess.php...?
if this helps any when you auto incr i think you also have to index that field
Hi glenn1137,
that's true, if the insertion query is on autoprocess.php you'll have to get the ID there either by putting it in a session where you can access it from every script or by moving it through the chain of scripts as GET or POST values. But
But you might need to rename autoreg.htm to autoreg.php.
Thomas