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

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

Re: [PHP] Help with logic :(

2005-10-14 Thread Dan McCullough
Not a problem, good to see. On 10/14/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: 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

Re: [PHP] Help with logic :(

2005-10-11 Thread Jochem Maas
Richard Lynch wrote: 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

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

Re: [PHP] Help with logic :(

2005-10-11 Thread Dan McCullough
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

Re: [PHP] Help with logic :(

2005-10-11 Thread Jochem Maas
Dan McCullough wrote: 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

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

Re: [PHP] Help with logic :(

2005-10-11 Thread Dan McCullough
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

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

RE: [PHP] Help with logic :(

2005-10-11 Thread Kilbride, James
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

Re: [PHP] Help with logic :(

2005-10-11 Thread Silvio Porcellana
[EMAIL PROTECTED] wrote: ?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 =

RE: [PHP] Help with logic :(

2005-10-11 Thread aaronjw
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

Re: [PHP] Help with logic :(

2005-10-11 Thread John Nichel
[EMAIL PROTECTED] wrote: ?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 =

Re: [PHP] Help with logic :(

2005-10-11 Thread Dan McCullough
$result = mysql_query($query) or die(mysql_error()); On 10/11/05, Silvio Porcellana [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: ?php include (../utils.inc); $date = date(U); $dateExpire = $date + 90 * 86400; $code = jack; $query = INSERT

Re: [PHP] Help with logic :(

2005-10-10 Thread Dan McCullough
create a function to check if the rndnumber=couponcode row count = 0 if not then redo rndnumber if it does = 0 then insert rndnumber On 10/10/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hey guys, Having trouble coming up with a solution to this idea I am trying to implement. I have a

Re: [PHP] Help with logic :(

2005-10-10 Thread Richard Lynch
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