RE: 2 Questions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I should have mentioned that I use a *normalized* database wharehousing
pattern where each row represents a distinct item being purchased. There
could be fifty rows corresponding to a single order transaction like what
you would see in something like an itunes music purchase. So using the auto
increment id would not work to differentiate between orders. Another user
mentioned microtime.

-----Original Message-----
From: Jochem Maas [mailto:jochem@xxxxxxxxxxxxx] 
Sent: Saturday, September 13, 2008 6:06 PM
To: Tom Shaw
Cc: 'PHP General'
Subject: Re:  2 Questions.

Tom Shaw schreef:
> 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. 
> 

1. order number are often *required* (for accounting purposes) to be
consecutive
2. the chance is small, yet it is there ... agravated by the fact that most
orders
are placed during a concentrated period of the day.

I have no idea what you mean by 'extra time column' and/or using it to keep
track of an order... but most DBMSs have the ability to auto store a
timestamp
into a field when the given record is created.

oh ... timestamps are hardly random.

>  
> 
> 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.  
> 

have your simple wrapper do something like:

$sql = "SELECT foo AS {$tablename}_foo FROM {$tablename} WHERE 1";

with regard to generating the query. if your wrapper doesn't generate the
SQL then you'll have to parse the given SQL and rewrite it ... good luck
with that.


> 
> Cheers
> 
>  
> 
> Thomas Shaw
> 
> Php.coder@xxxxxxxxx
> 
>  
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux