Jump to content

Recommended Posts

// 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);

Link to comment
https://forums.phpfreaks.com/topic/208124-cant-insert-data-into-table/
Share on other sites

Sorry... forgot to say: 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.

How do you know the query is executing? Add the or die() statements to both of your queries like the example below and see if you get any errors.

 

$result2=mysql_query($sql2) or die( 'This query cratered: ' . $sql2 . '<br />And produced this error: ' . mysql_error() );

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.