Links Directory - Need some help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Links Directory - Need some help!

Post 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
User avatar
skehoe
Forum Commoner
Posts: 59
Joined: Sun Dec 22, 2002 5:57 am
Location: Denver

Post 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...
Mr. Tech
Forum Contributor
Posts: 205
Joined: Tue Feb 11, 2003 4:18 pm
Location: Australia

Post by Mr. Tech »

Thanks! Yes it was the auto-incrementing and it is working now!

Cheers :mrgreen:
Post Reply