Previous Thread
Next Thread
Print Thread
Rate Thread
Added Fields & Table need a little guidance. #280078 09/27/2004 3:58 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
I have added a new field to my users table (U_UserGroup ) and also added a table (wt3_UserGroups) that has a list of values that I would like to display a popup in the editbasic.tmpl the popup will show the all values from the new table. Selecting the item from the popup will insert the primary unique key from the wt3_UserGroup table. into the field in the users table.

Then when I choose to display the data chosen the information from the table is display based upon the primary key...

what do i do next?

Sponsored Links
Re: Added Fields & Table need a little guidance. [Re: sdf123] #280079 09/27/2004 4:02 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
Then my next task is to build a front end for the new table to allow the addition of a new record.

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280080 09/28/2004 12:24 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
I added the mod similar to the Modification Index here where when the poster
makes a new post they are presented with an alternate template.

Then on submit all the "text" from the fields are placed in the body. But I need the
data from the fields to also populate my new table.

I am trying to figure out how to insert data to a new table?

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280081 09/28/2004 12:42 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
this is what I put in addpost.php
Code
 <br />if ($Board == "fmsd"){ <br />$query = " <br />	INSERT INTO {$config['tbprefix']}UserGroups (UG_Name,UG_Acronym,UG_State,UG_City,UG_URL,UG_Type,UG_Description,UG_Day,UG_Time,UG_Frequency,UG_Location,UG_PosterID) <br />	VALUES ('$Subject','$acronym','$state','$city','$meeturl','$meettype','$meetdesc','$meetday','$meettime','$meetfreq','$meetloc','$posterid') <br />"; <br />$dbh -> do_query($query,__LINE__,__FILE__); <br /> <br />} <br />


I think it is working with this... [fingers crossed]

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280082 09/28/2004 1:07 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
need to limit the adding of record to only new posts

Code
 <br />if (($Board == "fmsd") && ($meetsubmit == "yes")) { <br />$query = " <br />	INSERT INTO {$config['tbprefix']}UserGroups (UG_Name,...


i put this in but doesn't add any then?

Last edited by oceanwest; 09/28/2004 4:33 PM.
Sponsored Links
Re: Added Fields & Table need a little guidance. [Re: sdf123] #280083 09/28/2004 2:44 PM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
whats phpinfo() say $meetsubmit is when you click submit on the page? may be a problem of global off which in case you may have to add a $_GET or $_POST call on the value. All I can say is that when I am working on a script I use phpinfo(); alot to se what values the submit is actually submitting when it is clicked.

Re: Added Fields & Table need a little guidance. [Re: 234234] #280084 09/28/2004 4:31 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
how do you use phpinfo()?

The variable $meetsubmit is supplied by a hidden tag in the template.

and I have it set at the very top of the script.

$meetsubmit = get_input("meetsubmit","post");

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280085 09/28/2004 4:46 PM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
in the top of your php code under the <? put phpinfo(); it will provide all the details ya ever need including all variables and the like and their variables.

Re: Added Fields & Table need a little guidance. [Re: 234234] #280086 09/28/2004 8:07 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
Thanks scrounger, I did check it and yes the variable is set.
just don't know why it fails the test just prior to at insert?

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280087 09/28/2004 8:42 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
I really hadn't changed much other then add a few things, now when I edit the record the reply makes its own post instead of being tied to the parent post. Also other strange things when I hit the view thread sometimes i am taken to some arbitrary thread somewhere in the form.?

Perhaps it has something to do w/ preview template and some variable not passing?

Last edited by oceanwest; 09/28/2004 8:49 PM.
Sponsored Links
Re: Added Fields & Table need a little guidance. [Re: sdf123] #280088 10/01/2004 11:32 AM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
Update.. Ok I managed to sort it out i had my update table smack in the middle of another if statement and that was why it went sideways, when I replied to the post.

So now I have the adding of data working fine. The fields in the template the posting of the data to the table I even am capturing the post number and placing it into a field in my new table. Now comes the task of pulling the data from table incase they edit the post.

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280089 10/01/2004 6:34 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
Awesome! I can't believe I did it I have it working, my special forum is now posting and pulling and displaying correct data from the new table.

Now on to the next task of building a drop down list based upon data in the table.

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280090 10/01/2004 8:10 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
I amuse myself. I just figured that part out too. Members can now choose which user group they belong to from a popup menu. That is dynamic based upon the new table. Also in the show flat under the avatar it also shows their selected group with a link to the thread? I am so stoked.

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280091 10/01/2004 8:33 PM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
Cool keep up the good work

Re: Added Fields & Table need a little guidance. [Re: 234234] #280092 10/01/2004 9:29 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
Thanks spoke too soon

I am getting a strange issue with showflat... replies don't show up but they do in showthreaded?

http://www.fmforums.com/threads/showflat.php?Cat=0&Number=126512&an=&page=0&vc=1

where do I begin to address this? HELP!

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280093 10/01/2004 10:12 PM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
// User Group Display

$query = "
SELECT UG_Acronym,UG_PostID
FROM {$config['tbprefix']}UserGroups
WHERE UG_ID = '$ugID'
";
$sth = $dbh -> do_query($query,__LINE__,__FILE__);
list($ugAcronym,$ugPostID) = $dbh -> fetch_array($sth);


has something to do with this?

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280094 10/02/2004 12:18 AM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
umm just one observation if that is inside one of the query calls you will have to rename the $sth to $sti,$stj, etc so if its inside a query call in showflat rename it and try that

Re: Added Fields & Table need a little guidance. [Re: 234234] #280095 10/02/2004 12:56 AM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
ohh i think i get it st means string and the h / i / j is just another variable to hold the array?

It seems to work

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280096 10/03/2004 6:31 PM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280097 10/04/2004 5:16 AM
Joined: Sep 2003
Posts: 488
Twisty Offline
Code Monkey
Offline
Code Monkey
Joined: Sep 2003
Posts: 488
I always name my querries differently even if they aren't being called inside another. A lot easier to keep track of 'em all imo :-)

Re: Added Fields & Table need a little guidance. [Re: smoknz28] #280098 10/04/2004 6:25 AM
Joined: Oct 2003
Posts: 2,305
scroungr Offline
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
yeah me to I often call things what they are so if I am querying for say finding pencils I call it $pencilsquery

Re: Added Fields & Table need a little guidance. [Re: 234234] #280099 10/05/2004 2:00 AM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
ok my little statement in showflat is in the postrow area of the script just above

// New posts in topic?

the problem is that all the others users post is showing my data in their post?

how come? Did I put this in the wrong place?

Re: Added Fields & Table need a little guidance. [Re: sdf123] #280100 10/05/2004 2:01 AM
Joined: Apr 2002
Posts: 474
oceanwest Offline OP
Enthusiast
OP Offline
Enthusiast
Joined: Apr 2002
Posts: 474
i need to make my statement more restrictive.

Code
 <br />  // User Group Display <br /> <br />	if($ugID){ <br /> <br />	$query = " <br />		SELECT UG_Acronym,UG_PostID <br />		FROM   {$config['tbprefix']}UserGroups <br />		WHERE  UG_ID = '$ugID' <br />	"; <br />	$sti = $dbh -> do_query($query,__LINE__,__FILE__); <br />	list($ugAcronym,$ugPostID) = $dbh -> fetch_array($sti); <br />	} <br /> <br />	if(($ugPostID) && ($ugID)){ <br />    $postrow[$i]['usergroup'] = "Member: <a href='http://www.fmforums.com/threads/showflat.php?Cat=0&Number={$ugPostID}'/>$ugAcronym</a><br /><br />"; <br />	} <br />


that seemed to do it...

anyone else want to make this more tight?


Donate Today!
Donate via PayPal

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.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Pilgrim
Pilgrim
NH, USA
Posts: 190
Joined: June 2000
Forum Statistics
Forums63
Topics37,523
Posts293,713
Members13,832
Most Online5,166
Sep 15th, 2019
Top Posters(All Time)
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,788
Greg Hard 4,625
Top Posters(30 Days)
isaac 12
Gizmo 1
Today's Statistics
Currently Online 92
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 10
Top Likes Received (All Time)
isaac 27
Brett 7
Morgan 2
Slaz 1
DCPhil 1
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2019 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Snapshot build 20191201.dev)
Responsive Width:

PHP: 5.4.45 Page Time: 0.075s Queries: 61 (0.031s) Memory: 3.4247 MB (Peak: 3.7149 MB) Data Comp: Zlib Server Time: 2019-12-11 06:44:46 UTC
Valid HTML 5 and Valid CSS