Page 1 of 1

Links Directory - Need some help!

Posted: Tue Feb 11, 2003 4:18 pm
by Mr. Tech
Hi!

I am sort of new with PHP but know HEAPS of the basics. I'll still be asking a lot of questions though. :D

What I am creating is a links directory script.

What my problem is I don't know how to make it so when someone submits a new link it automatically gives it an id.

For example I create one link and it gives it the id 1 and then I create another link and it gives it an id 2 an so on.

Do you understand?

If so what code would I need for that?

Thanks

Tech

Posted: Tue Feb 11, 2003 5:37 pm
by skehoe
If you're storing the links in a DB just make sure to have an auto-incrementing ID field and then use that. Then you don't have to worry about it.

If you're storing them in a file, then you'll want to read the last entry in there, parse out the last ID and ++...

I hope that helps, but I have a feeling I missed the point...

Posted: Tue Feb 11, 2003 5:51 pm
by Mr. Tech
Thanks! Yes it was the auto-incrementing and it is working now!

Cheers :mrgreen: