Re: [PHP] 2 Questions.
- From: ash@xxxxxxxxxxxxxxxxxxxx (Ashley Sheridan)
- Date: Sat, 13 Sep 2008 23:49:06 +0100
On Sat, 2008-09-13 at 17:38 -0500, Tom Shaw wrote:
Can anybody give me any good reasons not to use a time stamp as an order
number in my shopping cart. It seems to me that the number is guaranteed to
be random and it saves having to make an extra time column to keep track of
the order. The only small concern I have is the chance that somebody orders
at the exact same time as somebody else but the chance of that has got to be
incredibly small but possible.
My second question is I've designed a very simple Postgres database wrapper.
The methods are exactly what you would assume to see in any db wrapper a
pg_query, pg_fetch_array. My question is in the db wrapper, is there an easy
way to always include the table name as an index in all my pg_fetch_array
returned results? The reason I ask is when designing my tables I'm delegated
to prefixing my column names i.e. users_name instead of just name or
forum_posts instead of just posts to make sure there's no collision.
Cheers
Thomas Shaw
Php.coder@xxxxxxxxx
Well, I think you answered the first part of your question yourself
there! Although remotely small, it is entirely possible for two people
to do something at the same time on your site. Why don't you use an
auto_increment column in your table instead? There are plenty of
functions in PHP to retrieve the auto_insert value (although generally
different for each type of database you connect to, I only know how to
do it in MySQL and MSSQL) This way, you let the database deal with the
unique ID's as it's something the databases are very suited to, and you
can then use the auto_insert ID in place of the value you would normally
generate in PHP.
Ash
www.ashleysheridan.co.uk
- Prev by Date: Re: [PHP] php image and javascript include
- Next by Date: Re: [PHP] 2 Questions.
- Previous by thread: localization folder for web site
- Next by thread: Re: [PHP] 2 Questions.
- Index(es):
Relevant Pages
|
Loading