Portal Home > Knowledgebase > Articles Database > PHP Variable Problem


PHP Variable Problem




Posted by stuffradio, 11-30-2007, 01:53 PM
I tried posting this on PHPFreaks... but haven't gotten any useful responses yet. So I'll post both my posts to try and make it make more sense! Post 1: I'm making a Trade System for a pet game. I'm making the form for setting up the trade. There are some duplicate items(these are allowed). The checkbox for what you want to trade contains the item id. I want to know how to check the item_id id so I can prevent duplicate items that aren't checked from being affected from the query. Post 2: Okay I'll try and explain a bit better... I'm sure you all know what a trading system is, so I won't explain that I have a list of all the items in your inventory that are not currently being traded. The list displays one item line by line. On each line there is a checkbox that has the value of that item id. I'm using that Item id to setup the trade, get the item info. I want to know how I can also get the id of the item. The id is the first column in the table, which is the primary key. I would like to use the id to tell it which item to do what with in case the other user has a duplicate item. I hope that clears it up for you.

Posted by Codebird, 12-05-2007, 02:22 PM
you should use a composite primary key which means that the item will have the item_id and the user_id as it's primary key like this you will never have duplicate ids. hope this is what you are searching for

Posted by stuffradio, 12-05-2007, 02:39 PM
Sorry... I've solved this about a week a go. I forgot about this thread



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
My site is hacked :( (Views: 785)
PHP and Mysql help? (Views: 782)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.