Re: db php question
| From: | Richard Davey | Date: | Thu, 15 Jan 2004 19:12:11 +0000 |
| Subject: | Re: db php question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32422@lists.php.net to get a copy of this message | ||
Hello,
Thursday, January 15, 2004, 7:09:25 PM, you wrote:
r> I have a very crude script set up that I am using to keep track of IP
r> addresses, MAC addresses, etc and it dumps into mysql. I am using a
r> column called "id" which is my primary key and auto-increments. My
r> question is that I want to make sure that I don't get duplicate IP
r> addresses added into the database and right now it is a varchar field
r> and anything can be put in there. If I change the column and make it my
r> primary key will that prohibit duplicate entries? Is there a better way
r> to do this? I am not a programmer either so I am having to hack my way
Set the IP column type to be Unique. It doesn't have to be a Primary
Key just to be unique.
r> through this. The second thing that I wanted to do was to be able to
r> run a simple web form search for either ip addresses or computer name
r> and return results. From what I have seen this seems pretty complex -
Actually, it's pretty simple. If you can post your SQL table structure
here someone could show you how to write a PHP script to display that
information pretty quickly I would have thought.
--
Best regards,
Richard mailto:rich@launchcode.co.uk