Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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
Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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.

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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?

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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]

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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 5:33 PM.
Sponsored Links
Joined: Oct 2003
Posts: 2,305
Old Hand
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.

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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");

Joined: Oct 2003
Posts: 2,305
Old Hand
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.

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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?

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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 9:49 PM.
Sponsored Links
Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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.

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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.

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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.

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
Cool keep up the good work

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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!

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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?

Joined: Oct 2003
Posts: 2,305
Old Hand
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

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305

Joined: Sep 2003
Posts: 488
Code Monkey
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 :-)

Joined: Oct 2003
Posts: 2,305
Old Hand
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

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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?

Joined: Apr 2002
Posts: 474
Enthusiast
Enthusiast
Offline
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?


Link Copied to Clipboard
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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)