|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
I added this to the area in addpost.php The Last item "B_FMVersion" and "$fmversion"
Early in the script the $fmversion is defined... but it the value is empty when I look at the db.
$query = " 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) 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') ";
|
|
|
|
Joined: Dec 2000
Posts: 1,471
Addict
|
Addict
Joined: Dec 2000
Posts: 1,471 |
This snipptet looks ok, so the error should be where you define your $fmversion.
Put error_reporting(15);
at the top of your script and see if any warnings occur.
|
|
|
|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
i hadn't noticed any errors.
this is where i define the variables
$fmversion = get_input("fmversion","post"); $fmplatform = get_input("fmplatform","post");
|
|
|
|
Joined: Dec 2000
Posts: 1,471
Addict
|
Addict
Joined: Dec 2000
Posts: 1,471 |
You could echo out these two variables right before the insert statement:
echo "fmversion: " . $fmversion: echo "fmplattform: " . $fmplattform;
and you can do a print_r($_POST);
to see what variables are available from the form.
I assume that they are just an empty string. So the problem maybe the form where these values are set.
|
|
|
|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
the values are coming from their profile. (josh added 2 fields in the user file.)
|
|
|
|
Joined: Oct 2000
Posts: 2,223
Veteran
|
Veteran
Joined: Oct 2000
Posts: 2,223 |
How are they scoped? Are they available to that particular piece of code? Astaran had the best idea, echo them out to screen just before you try to use them. See if they are empty values, undefined, or - if they have a value what that value is.
Picture perfect penmanship here.
|
|
|
|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
AARG... I guess this is over my head?!
The data is set from their profile. And they can choose to change it when they create a post. So I think the data is coming from the previous script newpost.php and pulled from the profile.
I am not really certain what you mean by echo out the code?!
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
He has a pull down box on the new post page - which let's the user choose the version number, and then it appends it to the front of the subject in addpost. Stephen - I checked your code and it IS working correctly if you post without preview. The reason it doesn't work if you preview is because the form that you post from after preview is no longer passing the $fmversion variable (because after we appended it to the subject, you didn't need it. So what you did to add it to the DB is fine - but to make sure it doesn't get lost if the user previews - you need to add the variable to the addpost_preview.tmpl Like this: <input type="hidden" name="fmversion" value="$fmversion" /> To all the hidden variables near the top of the form AND the hidden variables in the second form on that page - so if they edit more than once the variable still gets passed. Then it gets added to the DB. But then - since the addpost script will also append their usernumber to the end of their post - if they preview more than once, it keeps adding it. So we add a second variable to "switch off" adding this each time it comes from the addpost_preview.tmpl So to BOTH forms in addpost_preview.tmpl, I added this as well: <input type="hidden" name="noversion" value="1" /> Then add a get_input call for noversion using post. And modify the code at the top from this: <br />if (($fmversion) && (!$Parent)) {<br /> $Subject = "[$fmversion] ".$Subject;<br />}<br /><br />if ($fmversion) {<br />$Body = $Body."\n\nFileMaker Version: $fmversion";<br />}<br />if ($fmplatform) {<br /> $Body = $Body."\nPlatform: $fmplatform";<br />} <br /> to this: <br />if (($fmversion) && (!$Parent) && (!$noversion)) {<br /> $Subject = "[$fmversion] ".$Subject;<br />}<br /><br />if (($fmversion) && (!$noversion)) {<br />$Body = $Body."\n\nFileMaker Version: $fmversion";<br />}<br />if ($fmplatform) {<br /> $Body = $Body."\nPlatform: $fmplatform";<br />} <br /> So take a look at what I did to fix it - should be working now.
|
|
|
|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
Thank you Josh there is a dim flicker of light starting to float above my head. Or I am just delirious.
It is working. Along w/ the replace function (How To) post I made I decided to take out the prepending the subject as people were complaining that they have to visual acrobatics to read the subject. Since I am capturing the data in a field at a later point when i am fully caffeinated I will look into adding this field in the display perhaps in the search and in the postlist.
Thanks for taking the time to explain it...
BTW what book do you recommend for beginners to learn the basics of SQL syntax?
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
I enjoyed PHP Cookbook from O'Reilly Press, that was a pretty basic overview. Then MySQL/PHP Database Applications by Jay Greenspan and Brad Bulger was a bit more indepth, but it's handy for reference and I still refer to that one regularly for syntax etc....
|
|
|
|
Joined: Apr 2002
Posts: 474
Enthusiast
|
Enthusiast
Joined: Apr 2002
Posts: 474 |
Thanks
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
Posts: 1,157
Joined: July 2001
|
|
Forums63
Topics37,573
Posts293,925
Members13,849
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|