UBB.Dev
Posted By: oceanwest Updating 2 fields? - 09/23/2004 5:22 AM
I added two fields to my post table and can't figure out why addpost.php will not update the database.

isn't this correct?
Code
<br />$query = "<br />	INSERT INTO {$config['tbprefix']}Posts (B_Board,B_Parent,B_Main,B_Posted,B_Last_Post,B_IP,B_Subject,B_Body,B_Kept,B_Status,B_Approved,B_Icon,B_Reged,B_Poll,B_Replies,B_Topic,B_Convert,B_PosterId,B_AnonName,B_Sticky,B_ParentUser,B_CalDay,B_CalMonth,B_CalYear,B_AddSig,B_FMVersion,B_FMPlatform)<br />	VALUES ('$Board_q','$Parent','$Main','$date','$date','$IP_q','$Subject_q','$BodySig','$Kept_q','$PStatus_q','$Approved_q','$Icon_q','$Reged_q','$PollId','0',$MainTopic,'$convert_q','$posterid','$AnonName_q','$Sticky','$ParentUser','$calday','$calmonth','$calyear','$addsig','$fmversion','$fmplatform')<br />";<br />


if you want to see the template or script let me know I'll post em.
Posted By: JoshPet Re: Updating 2 fields? - 09/23/2004 5:24 AM
The query is correct - maybe the variable isn't getting set right.

To test - before that query put this:

echo "fmversion: $fmversion fmplatform: $fmplatform";
exit;


Now make a post - the screeen will display the above. Make sure they each have a value, if not, track it back and check all the variables. Might be a typo somewhere.
Posted By: oceanwest Re: Updating 2 fields? - 09/23/2004 5:57 AM
this was the result...

fmversion: fmplatform:


I have this near the top of the script...

$fmversion = get_input("fmversion","post");
$fmplatform = get_input("fmplatform","post");
Posted By: oceanwest Re: Updating 2 fields? - 09/23/2004 6:01 AM
This is the code in the template (newpost.tmpl)

Code
<br />{$ubbt_lang['FM_VER']}<br /><br /><br /><select name="fmversion" class="formboxes"><br /><option value="{$user['U_FMVersion']}">{$user['U_FMVersion']}</option><br /><option value="">----</option><br /><option value="">n/a</option><br /><option value="">----</option><br /><option value="3">3</option><br /><option value="4">4</option><br /><option value="5">5</option><br /><option value="6">6</option><br /><option value="7">7</option><br /><option value="">----</option><br /><option value="Dev 6">Dev 6</option><br /><option value="Dev 7">Dev 7</option><br /><option value="">----</option><br /><option value="Server 3">Server 3</option><br /><option value="Server 5">Server 5</option><br /><option value="Server 7">Server 7</option><br /></select><br /><br /><br /><br />{$ubbt_lang['FM_OS']}<br /><br /><br /><select name="fmplatform" class="formboxes"><br /><option value="{$user['U_FMPlatform']}">{$user['U_FMPlatform']}</option><br /><option value="">n/a</option><br /><option value="Windows XP">Windows XP</option><br /><option value="Windows 2000">Windows 2000</option><br /><option value="Windows 95/98">Windows 95/98</option><br /><option value="Mac OS 9">Mac OS 9</option><br /><option value="Mac OS X Panther">Mac OS X Panther</option><br /><option value="Mac OS X Jaguar">Mac OS X Jaguar</option><br /><option value="Linux">Linux</option><br /></select><br /><br /><br />{$ubbt_lang['POST_TEXT']}
Posted By: JoshPet Re: Updating 2 fields? - 09/23/2004 7:53 AM
Are you previewing?

If so you'll need to add them as hidden fields in the addpost_preview template - otherwise there's nothing passing them from addpost.php back to addpost.php when the post is made.

I bet the way it is now would work without preview.
Posted By: oceanwest Re: Updating 2 fields? - 09/23/2004 9:09 AM
Thanks That did the trick.
Posted By: JoshPet Re: Updating 2 fields? - 09/23/2004 7:36 PM
Power of the fanny pack.
© UBB.Developers