Page 1 of 1

Crazy problem with Delete statement

Posted: Mon Aug 11, 2003 10:55 am
by JPlush76
I'm executing a block of code and what I want to do is basically if the variable matches my check I want to delete the record and display a msg. So I run a delete query and then and echo statement.

The problem is the echo statement NEVER appears unless I comment out the sql call. The record gets deleted so I know its hitting this loop correctly but the echo NEVER works. crazy.

Anyone have any thoughts?

Code: Select all

<?php
if($prod_1 == 5702 || $prod_2 == 5702)
		{
			
			$result3 = query_db("SELECT * FROM shopping_cart WHERE session_id = '".$_COOKIE['cart_id']."' AND product_id = 5702");
			$num_row3 = @mysql_num_rows($result3);
			
						
			
			if($num_row3 > 0)
			{
				echo '<BR><BR><B><font color="red">You have already used the Bergger sample promotion for item# 237281</font></B><BR>';
				$result4 = query_db("DELETE FROM shopping_cart WHERE session_id = '".$_COOKIE['cart_id']."' AND product_id = 5702");
				
			} 
			
					}
		
?>

Re: Crazy problem with Delete statement

Posted: Mon Aug 11, 2003 8:34 pm
by McGruff
That is strange... I can't see, given that the $num_row3>0 case is being called, why the echo won't work.

Commenting out the DELETE query would cut out a syntax error in that line, but then it can't be a syntax error if the DELETE query does work and you'd be getting error messages - which you're not.

Posted: Mon Aug 11, 2003 9:32 pm
by JPlush76
actually I figured out what was happening this afternoon

damn ssl redirection and output buffering.

needless to say it was executing the code twice. so the second time there were no records so it would not echo. my boo boo :oops: