close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

UserID added to Product Update

Thread began 3/04/2010 10:26 am by jed193733 | Last modified 3/15/2010 4:09 pm by Eric Mittman | 2479 views | 11 replies |

jed193733

UserID added to Product Update

I'm using this store foundation for something a bit different than an online store. I need to add the userID to the database when an update or addition is made.

I've been looking around the ProductsInsert.php and am confused with $_Post from the lines 157-8. I've been able to add the column in the database and create my own form to update the database, but would like to use the WA form in place.

Am I looking at the right lines? Can you give me the proper syntax to $_Post the userID to the Products table? I hope you can help me this. Thanks.

Sign in to reply to this post

Eric Mittman

How are you getting the value for the user id currently? By default the only user id that would be available to you in the admin is the id for the administrator user. To get the id for a regular site user you would need to use the session variable for their id or something like this. On the front end of the site the id is held in a session variable when a user logs in. So on any of those pages you can make reference to this users id whenever they are logged in.

Please post back and describe a little more about the specifics and what you are trying to accomplish and we will help you out with whatever we can.

Sign in to reply to this post

jed193733

UserID

Yes, I was thinking I could use the session UserID. I've been able to echo it on the update page after logging in so I thought I that would work. I was thinking read the session UserID and post it in the new column userID column in the products table.

Trying to keep it simple right now.

Complex version later - tracking the edits like content management tracking section.

Sign in to reply to this post

Eric Mittman

If you can see the userID session var on the update page already then you just need to bind it to your userID column that you have for that table. It sounds like you are well on the way, let us know if you have any further questions about this or any other part.

Sign in to reply to this post

jed193733

Binding...

I'm having some trouble understanding the sql insert statement.

From the Products_Insert.php I've changed the following lines:

Line 157:....ProductUnlimited|MarkerUserID";

Line 158:......((isset($_POST["ProductUnilimited"]))?$_POST["ProductUnilimited"]:"") ."|" . "".($_SESSION['UserID']) ."";

Line 159:...NULL|none,1,0|none,1,0";

This is all I've changed and it's not updating - am I working on the right lines? what's wrong with my syntax.

Thanks in advance...

Sign in to reply to this post

Eric Mittman

This is a change that may be a little difficult to make manually since the code you are editing was created with DataAssist. If you can post back with the page that contains the updated code in it I can take a look at things and let you know what I think. I should be able to help you get this worked out.

Just for clarification, the session variable $_SESSION['UserID'] is set when you are on this update page correct?

Sign in to reply to this post

jed193733

Yes the userID is set - I test that by displaying it on the bottom of the page - line: 742

new Insert file attached. Thanks Eric. If you want to register yourself I'll be happy to give you access to the site. keywesthistoricmarkertour.org/3

Attached Files
Markers_Insert.zip
Sign in to reply to this post

Eric Mittman

Thanks for getting this page to me. The updated insert server behavior has been edited correctly and you have setup the insert parameters without error. The problem is that this code is never being executed. You have the action of the form still going to the product insert page. You should either leave it blank or set it to this Markers insert page.

I did a test of your page with a copy of my products table and can confirm that the userID is making it's way into the table.

Sign in to reply to this post

jed193733

Sorry .....

Thanks Eric... I'm getting this error when I change the action to Markers_Insert.php.

Unknown column 'MarkerUserID' in 'field list'

Feeling a little dumb here.....thanks for your patience....

Sign in to reply to this post

Eric Mittman

This error you are getting means that it cannot identify the column named MarkerUserID in your table. When I tested this I had to add this column to my table in order for the insert to work properly. Once I did this and adjusted the action it inserted without issue. I probably should have caught this earlier but I was assuming that the column already existed.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...