Thanks Viraj,I'll read it.
hi nigen,
the intention of that 'exit' was to stop the script temporarily to
avoid any second time inserts. i think you better figure-out what
caused your script to insert same data twice in a single form post.
to hide the form, 'exit' is not the best option. there are several
different ways, one
in this topic problem WAS this one:
insert to a table twice(that was solved)
and on that post problem is this one:
working with echo html then insert to a table (problem in $_POST)
I thought it is very different am i wrong?
cause it's in another topic!!! and another problem!
this problem was solved
i had another problem
what do you mean!?
But why do you double-post your question?
http://news.php.net/php.general/313198
?
On Sat, May 28, 2011 at 11:21, Negin Nickparsa wrote:
> i'm wondering that what was the problem!
> why with just a session it now works propely!!!
> how!
>
i'm wondering that what was the problem!
why with just a session it now works propely!!!
how!
Negin Nickparsa wrote:
I click the submit button just one time! not twice
but when i go to MySql and select * from it
it shows me happening two times
The code looks OK, so something is hitting it twice. I normally have a unique
index on anything that I do not want duplicates in - which would the
i used your exit too,yes it's better to hide the form after registration:)
Yes viraj it was in both tables
Hi viraj
intresting!
i changed the code to this:
$kind=$_SESSION['s3'];
$query1="insert into
user(kind,user,pass,name)values('$kind','$str','$str2','$str3')";
$result1=mysql_query($query1);
i set the session in my another page
and now it works properly:D
LOL!!
hi negin,
do you get duplicate inserts into both tables? if yes, try an
'exit();' right after the success message;
echo "you have been registered successfully!";
exit();
this will stop the script after the message, and you wont see the form
either. at this point check the tables for duplicate rec
I click the submit button just one time! not twice
but when i go to MySql and select * from it
it shows me happening two times
Consistently
here is the code:
Registration
Complete the form below:
Name:
Last name:
Username:
Password:
Negin Nickparsa wrote:
I have a code that i get the $_POST's result and then insert them in tables
of Mysql
it can run without error but it'll insert in the table twice and i don't
know why.
when I click the submit then with array_key_exists I go to if statement and
insert it.
i'll show the code
14 matches
Mail list logo