Re: [PHP] Help with logic :(

2005-10-14 Thread aaronjw
Hi all,

Just wondering how one would do multiple rows?

Instead of me me copying and pasting the same row of code 15 times
(multiple data entry form), I just loop until it counts 15?

Loops are not a strong point for me at all :(

Thanks in advance!!!

Aaron

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



Re: [PHP] Help with logic :(

2005-10-14 Thread aaronjw
NEVERMIND.

Solved it.

Thanks!!!

A

 Hi all,

 Just wondering how one would do multiple rows?

 Instead of me me copying and pasting the same row of code 15 times
 (multiple data entry form), I just loop until it counts 15?

 Loops are not a strong point for me at all :(

 Thanks in advance!!!

 Aaron

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



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



Re: [PHP] Help with logic :(

2005-10-11 Thread aaronjw
Hi Richard,

Ok... I do already have a Unique index on the column but this process is
something that I cannot echo out the error code to the user. The code is
generated on the fly when an order an is placed so you can see... I can't
echo out the error to the customer.

Can I do an if statement IF an error is returned to try generatre another
randon code and keep going until one is available? I can do this all
intenrally without the customer knowing/seeing anything?

Hope I am making some sense. Not trying to confuse the issue.

Thanks. Appreciate your thoughts.

Aaron

 On Mon, October 10, 2005 3:24 pm, Dan McCullough wrote:
 create a function to check if the rndnumber=couponcode row count = 0
 if not then redo rndnumber if it does = 0 then insert rndnumber

 N!

 You are creating a RACE CONDITION in which ONE user might generate a
 'valid' code, and ANOTHER user might generate a 'valid' code AT THE
 SAME TIME, and then they BOTH get the same coupon code.

 The probability of this is very very very low, but still NOT zero.

 And it's the kind of thing that won't show up in testing, but sure as
 God made little green apples, it WILL happen at the worst possible
 time after you go live

 The database engine has a *TON* of code in it to avoid this kind of
 Bad Thing happening.

 Use it.

 create a UNIQUE INDEX on the column that needs to be unique.

 Trap the INSERT error.

 --
 Like Music?
 http://l-i-e.com/artists.htm

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



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



Re: [PHP] Help with logic :(

2005-10-11 Thread aaronjw
Thanks everyone. Makes sense. Now I got another issue.

When I try to see if an error exists I get this:

Warning: mysql_error(): supplied argument is not a valid MySQL-Link
resource in /home//public_html/Store/test.php on line 14

Is there a setting somewhere that I need to set to make sure this is
available?

Thanks and sorry is these are dumb-ass questions :)

Aaron


 Yes I believe that is what Richard was saying about Trap the INSERT
 error, you should get an error back from the database about having a
 problem with the insert instead of showing that error you will want to
 add some logic that when that error occurs you simply generate another
 number.

 On 10/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Hi Richard,

 Ok... I do already have a Unique index on the column but this process is
 something that I cannot echo out the error code to the user. The code is
 generated on the fly when an order an is placed so you can see... I
 can't
 echo out the error to the customer.

 Can I do an if statement IF an error is returned to try generatre
 another
 randon code and keep going until one is available? I can do this all
 intenrally without the customer knowing/seeing anything?

 Hope I am making some sense. Not trying to confuse the issue.

 Thanks. Appreciate your thoughts.

 Aaron

  On Mon, October 10, 2005 3:24 pm, Dan McCullough wrote:
  create a function to check if the rndnumber=couponcode row count = 0
  if not then redo rndnumber if it does = 0 then insert rndnumber
 
  N!
 
  You are creating a RACE CONDITION in which ONE user might generate a
  'valid' code, and ANOTHER user might generate a 'valid' code AT THE
  SAME TIME, and then they BOTH get the same coupon code.
 
  The probability of this is very very very low, but still NOT zero.
 
  And it's the kind of thing that won't show up in testing, but sure as
  God made little green apples, it WILL happen at the worst possible
  time after you go live
 
  The database engine has a *TON* of code in it to avoid this kind of
  Bad Thing happening.
 
  Use it.
 
  create a UNIQUE INDEX on the column that needs to be unique.
 
  Trap the INSERT error.
 
  --
  Like Music?
  http://l-i-e.com/artists.htm
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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



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



Re: [PHP] Help with logic :(

2005-10-11 Thread aaronjw
?php

include (../utils.inc);

$date = date(U);
$dateExpire = $date + 90 * 86400;

$code = jack;

$query = INSERT INTO CouponTable VALUES
('','$date','0','$code','preset','$dateExpire','3.75');

$result = mysql_query($query);

echo mysql_error($result);

?

This SHOULD error out but I'm getting the error instead.

It's just a test page to test my logic...

A
 got some code so we can see?

 On 10/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Thanks everyone. Makes sense. Now I got another issue.

 When I try to see if an error exists I get this:

 Warning: mysql_error(): supplied argument is not a valid MySQL-Link
 resource in /home//public_html/Store/test.php on line 14

 Is there a setting somewhere that I need to set to make sure this is
 available?

 Thanks and sorry is these are dumb-ass questions :)

 Aaron


  Yes I believe that is what Richard was saying about Trap the INSERT
  error, you should get an error back from the database about having a
  problem with the insert instead of showing that error you will want to
  add some logic that when that error occurs you simply generate another
  number.
 
  On 10/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Hi Richard,
 
  Ok... I do already have a Unique index on the column but this process
 is
  something that I cannot echo out the error code to the user. The code
 is
  generated on the fly when an order an is placed so you can see... I
  can't
  echo out the error to the customer.
 
  Can I do an if statement IF an error is returned to try generatre
  another
  randon code and keep going until one is available? I can do this all
  intenrally without the customer knowing/seeing anything?
 
  Hope I am making some sense. Not trying to confuse the issue.
 
  Thanks. Appreciate your thoughts.
 
  Aaron
 
   On Mon, October 10, 2005 3:24 pm, Dan McCullough wrote:
   create a function to check if the rndnumber=couponcode row count =
 0
   if not then redo rndnumber if it does = 0 then insert rndnumber
  
   N!
  
   You are creating a RACE CONDITION in which ONE user might generate
 a
   'valid' code, and ANOTHER user might generate a 'valid' code AT THE
   SAME TIME, and then they BOTH get the same coupon code.
  
   The probability of this is very very very low, but still NOT zero.
  
   And it's the kind of thing that won't show up in testing, but sure
 as
   God made little green apples, it WILL happen at the worst possible
   time after you go live
  
   The database engine has a *TON* of code in it to avoid this kind of
   Bad Thing happening.
  
   Use it.
  
   create a UNIQUE INDEX on the column that needs to be unique.
  
   Trap the INSERT error.
  
   --
   Like Music?
   http://l-i-e.com/artists.htm
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 



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



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



RE: [PHP] Help with logic :(

2005-10-11 Thread aaronjw
It's open because if I remove the mysql_error(); and change the value for
$code it will insert.

A

 Did you remember to open the database connection?

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, October 11, 2005 1:34 PM
 To: Dan McCullough
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Help with logic :(

 ?php

  include (../utils.inc);

  $date = date(U);
  $dateExpire = $date + 90 * 86400;

  $code = jack;

  $query = INSERT INTO CouponTable VALUES
 ('','$date','0','$code','preset','$dateExpire','3.75');

  $result = mysql_query($query);

  echo mysql_error($result);

 ?

 This SHOULD error out but I'm getting the error instead.

 It's just a test page to test my logic...

 A
  got some code so we can see?
 
  On 10/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
  Thanks everyone. Makes sense. Now I got another issue.
 
  When I try to see if an error exists I get this:
 
  Warning: mysql_error(): supplied argument is not a valid
 MySQL-Link
  resource in /home//public_html/Store/test.php on line 14
 
  Is there a setting somewhere that I need to set to make
 sure this is
  available?
 
  Thanks and sorry is these are dumb-ass questions :)
 
  Aaron
 
 
   Yes I believe that is what Richard was saying about Trap the
   INSERT error, you should get an error back from the
 database about
   having a problem with the insert instead of showing that
 error you
   will want to add some logic that when that error occurs
 you simply
   generate another number.
  
   On 10/11/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
   Hi Richard,
  
   Ok... I do already have a Unique index on the column but this
   process
  is
   something that I cannot echo out the error code to the
 user. The
   code
  is
   generated on the fly when an order an is placed so you
 can see...
   I can't echo out the error to the customer.
  
   Can I do an if statement IF an error is returned to try
 generatre
   another randon code and keep going until one is
 available? I can
   do this all intenrally without the customer knowing/seeing
   anything?
  
   Hope I am making some sense. Not trying to confuse the issue.
  
   Thanks. Appreciate your thoughts.
  
   Aaron
  
On Mon, October 10, 2005 3:24 pm, Dan McCullough wrote:
create a function to check if the rndnumber=couponcode row
count   0
if not then redo rndnumber if it does = 0 then
 insert rndnumber
   
N!
   
You are creating a RACE CONDITION in which ONE user might
generate
  a
'valid' code, and ANOTHER user might generate a
 'valid' code AT
THE SAME TIME, and then they BOTH get the same coupon code.
   
The probability of this is very very very low, but
 still NOT zero.
   
And it's the kind of thing that won't show up in testing, but
sure
  as
God made little green apples, it WILL happen at the worst
possible time after you go live
   
The database engine has a *TON* of code in it to
 avoid this kind
of Bad Thing happening.
   
Use it.
   
create a UNIQUE INDEX on the column that needs to be unique.
   
Trap the INSERT error.
   
--
Like Music?
http://l-i-e.com/artists.htm
   
--
PHP General Mailing List (http://www.php.net/) To
 unsubscribe,
visit: http://www.php.net/unsub.php
   
   
  
  
  
   --
   PHP General Mailing List (http://www.php.net/) To unsubscribe,
   visit: http://www.php.net/unsub.php
  
  
 
 
 
  --
  PHP General Mailing List (http://www.php.net/) To
 unsubscribe, visit:
  http://www.php.net/unsub.php
 
 

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



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



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



[PHP] Help with logic :(

2005-10-10 Thread aaronjw
Hey guys,

Having trouble coming up with a solution to this idea I am trying to
implement.

I have a Coupon table.

I am creating radonly generated coupon codes that go into this table. 12
chars in length - both number and letters - all lowercase.

I figure I need to do the following:

1) generate the radon coupon code;

2) Do query against thethe table to pull out all the currently entered codes;

3) Loop through all codes to see if any match the randomly generated code;

4) if a match exists, generate code again and keep doing this until we
have a code that doesn't match;

5) If a match doesn't exist, insert code into DB and continue with rest of
my process.


What I am unsure of is how to loop through all codes in the DB and match
against current randomly generated code and if a match exists, keep
generating new random codes until one doesn't exist.

Any ideas on how to go about this?

Thank you in advance. Seems pretty simple I'm sure. Just confused on the
logic.

Thanks.

Aaron

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



[PHP] date comparisions...

2005-10-07 Thread aaronjw
I am confused... probably because of lack of sleep.

Anyway... I have code that looks like this:

if ($discountResult[dateexpired]  date(U))
{

  //dosomething

}
else
{

  //do something else

}

Using Epoch obviously

Anyway... it's supposed to read: IF the expired date is past the current
date... disallow dosomething otherwise... let it go.

I set the expire date to be Sept 30, 2005 and obviously today is the
current date but for some reason the dosomething is being allowed.

Do I have the operators mixed up here? Works is I reverse the operator but
shouldn't it work as I have it?

Thanks all. Appreciate the clarrification.

A

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



Re: [PHP] date comparisions...

2005-10-07 Thread aaronjw
Hi Rich,

Thanks for your reply.

dateexpired is: 1128052800 which translates into: 2005-09-30 00:00:00

Basically, I'm just trying to figure out when the dateexpired is. IF it is
past the current date then I am erroring out and if it's under the current
date... I'm allowing the transaction.

I would assume the following:

if (2005-09-30 00:00:00  2005-10-07 00:00:00)

it should error out, no?

Thanks!

Aaron

 Hi aaronjw,

 Start with the obvious - what actually IS the value of
 $discountResult[dateexpired]? var_dump it out and have a look. Check
 you are comparing like with like. You're also not performing a strict
 comparison, so string conversion could be going on here.

 The other obvious fact is that if dateexpired is less than *right
 now*, it'll always dosomething ! :)

 Cheers,

 Rich

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



[PHP] Port 443

2005-09-01 Thread aaronjw
Hey,

Using an API for an Ecomemrce app. Wondering how I can ensure I have
access to port 443 and that it's open?

Thanks!

A

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



[PHP] Form Processor?

2005-08-16 Thread aaronjw
Hey all,

Does anyone have any recomendations for a GOOD PHP Form Processor software?

Kind of in a bind and don't want to reinvent the wheel if I don't have to.

Sorry for thr O/T.

TIA!

A

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



[PHP] Event Registration Software?

2005-08-03 Thread aaronjw
Hey guys,

Sorry for the OT but I'm having difficulty with this.

Client wants us to develop an event registration system for their company
(multiple events) with the ability to accept credit card payments.

Just wondering if there is a PHP solution already available - paid or
opensource - that someone knows of?

Thanks in advance!

Aaron

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



[PHP] Ugh. Need some advice...

2005-07-11 Thread aaronjw
Sorry for the OT guys but I really need some advice.

I've just started a new company with a friend/associate of mine where we
will be selling about 5 products for now.

Obviously, I don't require a major front-end but I do require excellent
functionality for the back-end. Order Management, export to Quickbooks,
Affiliate/Referral Management, etc.

Due to a time issue I kind of need to get this in place rather quickly and
given the Quickbooks export featurer that's required... development of
this on my own makes it more unlikely.

Can anyone recommend a software package (free or paid... don't care) that
does what I am looking for? Like I said, simplistic in the front-end, but
full featured in the back-end.

Oh, and it must be VERY easy for us to integrate our current
design...quickly.

Thanks and once again sorry for the OT.

Aaron

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



Re: [PHP] Ugh. Need some advice...

2005-07-11 Thread aaronjw
 John Nichel [EMAIL PROTECTED] wrote:

 http://www.x-cart.com/

Yeah, I downloaded this to play aorund with it.

My problem is I am not that great at working with template engines/system.

I don't know where the f#!@ to change anything and the documentation isn't
all that self explanatory.

From the feature list, I'd like to use this software. It DOES do that I
need. It's just integrating it with our design... :(

Thanks John.

Aaron

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



Re: [PHP] Ugh. Need some advice...

2005-07-11 Thread aaronjw
  There is not going to be 1 easy solution that you can just magically tie
 in
 to your existing design. No matter what solution you chose, you are going
 to
 have to hack around to get it all working (any pre-written script). If it
 DOES everything you need, then you are not going to get any further with
 any other product. You are eventually going to have to succumb to
 integrating it with your existing design because the only other choice you
 have is writing your own cart/back end.
  [EMAIL PROTECTED]

Thanks. Appreciate your words.

I agree with you. Just a question now of whether to hire them to do the
design integration or attempt to figure it out ourselves. With a new
start-up, money is one thing we don't have while time is something we do
have.

The sadder part is, I could probably write the cart/back-end in the same
time it took me to figure out the templating but obviously with less
features.

Thanks again for replying.

Aaron

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