this is my code

i wanna insert value starting with cb into no table coming from form. but i cannot count $a (just starting with cb) value

foreach($_GET as $a=>$b){
		$q1 = "UPDATE no SET drm = 1,
								s = '$time',
								h	= '$dest'
							WHERE 
								s = '$b'";
		$q2	= "UPDATE no_ta SET gsayi=gsayi+$x";

								
						
		if(!mysql_query($q1) || !mysql_query($q2)){
				echo "Hata No : ".mysql_errno()."<br/> Hata Mesajı :".mysql_error();
				
			}	
	}

data coming from from like following

hedef-zodehala
button-Gonder
cb1-6319039
cb2-8151977
cb3-8151977
cb4-6914312
cb5-7749106
cb6-6622528
cb7-5707214

for example when i used count($a) result is 1111111 (seven one) in fact it must be just 7. how can i do it

Member Avatar for diafol

where do you get $x?

$x is the sum of form objects that begin with cb

Member Avatar for diafol

I assume that this is set somewhere before the loop

Why are you using $_GET? $_POST would be more tidy. I don't think you want all that data in the url.

Show your form.

what count() did you use? php count or sql count? I assume you use the php count, so the reason why it displayed 1111111 is because you put the php count() inside the loop

i am using php count in loop

Member Avatar for diafol

show your form

i don't even see the count() function on your code lol

Member Avatar for diafol

OK, I'm bugging out. Good luck. Stone, blood and getting are terms which spring to mind. :(

i sayed something but it didn't aplay

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.