close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Online Public Image Gallery

Thread began 11/19/2010 5:24 pm by hbibizadeh396670 | Last modified 11/23/2010 12:10 pm by Jason Byrnes | 2468 views | 15 replies |

hbibizadeh396670

Online Public Image Gallery

Hi

I am using Data Assist and CSS Form Builder 2 to create an online public gallery. My system as a whole works fine, showing images and ETC...

However, my problem

Before you can understand my question you need to know what I have made:

I have made a registration systems, when a person has signed up they can upload an Image with information that displays in a public gallery.

My problem is that on the update and delete pages, all images in the database show to any user.

In other words, anyone would be able to edit or delete another person’s uploads

What I would like to know is if it is possible to only show results for an individual users uploads rather then everyone’s.

Thanks In advance!

Sign in to reply to this post

Jason ByrnesWebAssist

The login page will store the users ID in a session variable.

you will need to filter the recordsets on those pages to filter the userID column on the ID session variable that is created.

Sign in to reply to this post

hbibizadeh396670

Thanks for your Help!

But before I change anything, can you tell me if it matters that my user database table and the database table I use for my system is seperate.

Sign in to reply to this post

Jason ByrnesWebAssist

well, to relate the images to the user, the second table will need a foreign key column to store the user ID, others wise you will not be able to relate the images to a specific user.

Sign in to reply to this post

hbibizadeh396670

Sorry but I am not sure how to do this

Firstly how do I create a foreign key column in PHPMYADMIN

And secondly

How do I filter the recordsets on the results pages to filter the userID column on the ID session variable that is created.

Sign in to reply to this post

Jason ByrnesWebAssist

a foreign key column is just a column that you add to the second table to create the relation ship to the users table.


Your users table will have a primary key column, this is a unique identifier for the user.

it will be set to a numeric value and will be controlled by the database using an automatically incrementing value.

This is the users id.

in the image table, you need a numeric column that will store the users id to create the relation of image to user.

if you are using Security assist, take a look at the recordset on the profile page, this will demonstrate how to filer the recordset on the user id session variable.

Sign in to reply to this post

hbibizadeh396670

Hi

I Re-made the system Using Data assist however this time I used the filter option on the "Set Up Results Page" Step.

Although the insert and updata parts work the results page returns with no results so I do not think it works

I am not sure how to make a foreign key column, so I just made a Identical UserID Key column in the Image database table. I have attached the pages and database .sql in case you would be so kind to take a look.

This would help me alot!

Attached Files
Image System.zip
Sign in to reply to this post

Jason ByrnesWebAssist

in you table you created a Primary key named UserID in both tables. this will not work


each table should have it's own primary key column

There is a difference between a primary key and a foreign key.
A primary key is used as a unique identifier for record.

In the case of the email address "ash@ash.com", the id column value is 8.

in your image table, you need to have a primary key column that is the unique identifier for the image record, and then also have a UserID column that is numeric. For each image that should be associated with the email address "ash@ash.com", set the value of the userID column to 8.


you may want to do some research using google on Foreign Keys and Primary Keys.

Sign in to reply to this post

hbibizadeh396670

Hi

I have changed my image database table and added a Foreign Key the looks at the users ID of the users table. I have also created a new Primary Key for my image table called CustID.

I also made a new system using the wizard to filler the results pages based on the session variable.

However, although the registration part of the system works fine, signing up and loging in.

The image part does not insert. I get the following error:

Cannot add or update a child row: a foreign key constraint fails (`login`.`imagetable`, CONSTRAINT `imagetable_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `users` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE)


I have attached my databases If you would be kind enough to take a Look, this may help you decide what the problem is?


Thanks

Attached Files
login.sql.zip
Sign in to reply to this post

Jason ByrnesWebAssist

you do not really need to designate the foreign key column as a foriegn key in the data base, this will force referential integrity and cause the error you are having.

The forign key designation can be left off at the database level, but you can still use the column as a foriegn key column.

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...