can't insert data to table

I am having a problem inserting data into a table. I’m carrying it over from a temp table and placing it in a permanent one. I think I am getting the data out of the temp table just fine, but can’t seem to get it placed into the second table.

Later on in the script when I check if($result2) I always get to the else because it didn’t process. I am sure the variables are not just blank because when they are sent in an email I receive the values just fine.

Any help at all would be excellent. Thanks.

[code]// set date variables

date_default_timezone_set(“America/New_York”);
$date=date(“l F d, Y, h:i:s”);
$datedb=date(“m.d.y”);

// passkey from email link

$confirm_code=$_GET[‘confirm_code’];

// access temporary table
$tbl_name1=“temp_member”;

// Retrieve data from table where row that match this passkey

$sql1=“SELECT * FROM $tbl_name1 WHERE confirm_code=’$confirm_code’”;
$result1=mysql_query($sql1);

// If successfully queried

if($result1){

// Count the row number of the passkey

$count=mysql_num_rows($result1);

// if the confirm_code is found in the database, retrieve data from table “temp_member”

if($count==1){

$rows=mysql_fetch_array($result1);
$confirm_code=$rows[‘confirm_code’];
$email=$rows[‘email’];
$output0=$rows[‘output0’];
$output1=$rows[‘output1’];
$output2=$rows[‘output2’];
$output3=$rows[‘output3’];
$output4=$rows[‘output4’];
$output5=$rows[‘output5’];
$output6=$rows[‘output6’];
$output7=$rows[‘output7’];
$output8=$rows[‘output8’];
$output9=$rows[‘output9’];
$output10=$rows[‘output10’];
$output11=$rows[‘output11’];
$output12=$rows[‘output12’];
$output13=$rows[‘output13’];
$output14=$rows[‘output14’];
$output15=$rows[‘output15’];
$output16=$rows[‘output16’];
$output17=$rows[‘output17’];
$output18=$rows[‘output18’];
$output19=$rows[‘output19’];
$output20=$rows[‘output20’];
$output21=$rows[‘output21’];
$output22=$rows[‘output22’];
$output23=$rows[‘output23’];
$output24=$rows[‘output24’];
$output25=$rows[‘output25’];
$output26=$rows[‘output26’];
$output27=$rows[‘output27’];

// access permanant table

$tbl_name2=“register_member”;

// Insert data that retrieves from “temp_member” into table “register_member”

$sql2=“INSERT INTO $tbl_name2(‘confirm_code’, ‘date’, ‘email’, ‘output0’, ‘output1’, ‘output2’, ‘output3’, ‘output4’, ‘output5’, ‘output6’, ‘output7’, ‘output8’, ‘output9’, ‘output10’, ‘output11’, ‘output12’, ‘output13’, ‘output14’, ‘output15’, ‘output16’, ‘output17’, ‘output18’, ‘output19’, ‘output20’, ‘output21’, ‘output22’, ‘output23’, ‘output24’, ‘output25’, ‘output26’, ‘output27’) VALUES (’$confirm_code’, ‘$datedb’, ‘$email’, ‘$output0’, ‘$output1’, ‘$output2’, ‘$output3’, ‘$output4’, ‘$output5’, ‘$output6’, ‘$output7’, ‘$output8’, ‘$output9’, ‘$output10’, ‘$output11’, ‘$output12’, ‘$output13’, ‘$output14’, ‘$output15’, ‘$output16’, ‘$output17’, ‘$output18’, ‘$output19’, ‘$output20’, ‘$output21’, ‘$output22’, ‘$output23’, ‘$output24’, ‘$output25’, ‘$output26’, ‘$output27’)”;
$result2=mysql_query($sql2);[/code]

I needed to remove the single quotes from the row names so that they would not be accessed as strings.

Sponsor our Newsletter | Privacy Policy | Terms of Service