Search found 30 matches

by knallbernd
Sat Jul 14, 2007 12:37 pm
Forum: Databases
Topic: ALTER TABLE - ADD UNIQUE in PHP
Replies: 5
Views: 570

Thanks. I will try this and let you know if it worked out.
by knallbernd
Sat Jul 14, 2007 2:08 am
Forum: Databases
Topic: ALTER TABLE - ADD UNIQUE in PHP
Replies: 5
Views: 570

That's the problem, because there are empty fields in the column which are not UNIQUE, so I'd like to make an exception to exclude
those empty fields while creating a new UNIQUE column.
by knallbernd
Fri Jul 13, 2007 12:42 pm
Forum: Databases
Topic: ALTER TABLE - ADD UNIQUE in PHP
Replies: 5
Views: 570

ALTER TABLE - ADD UNIQUE in PHP

Hi, I want to add an UNIQUE-Constraint to my new column. $sql="ALTER TABLE table ADD UNIQUE $y varchar(150) NOT NULL "; mysql_query($sql); But that doesn't work. What's wrong with this? The second question is: How can I manage to say that empty fields (like #1062 - Duplicate entry '' for k...
by knallbernd
Thu Jun 28, 2007 10:59 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

It's even more easy...

According to the GUI-Guidelines, a radiobutton has always be checked from the beginning - this solves my problem, because there is no danger to have an empty field.
by knallbernd
Thu Jun 28, 2007 7:47 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Aah, now I got it! I also tried to do it much more easier: $validated = (!empty($_POST['Frage1'][$key]) && !empty($_POST['Frage2'][$key])); if (!$validated) { echo "incorrect"; } else { //UPDATE... So it will only write values if there are all values filled by one persona --> not a...
by knallbernd
Thu Jun 28, 2007 7:37 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

You mean that I put this function into "formular.php" (the site the form is send to)? But why du you SELECT everything again?
Maybe you could paste the into the existing code because I don't understand it right now :(
by knallbernd
Thu Jun 28, 2007 3:03 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Now I'm even more confused...
Do you put that after the echo "rname? And why $kurs in a hidden field - that shouldn't matter to the validation.
Sorry...
by knallbernd
Wed Jun 27, 2007 9:20 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Sorry, me again. I'm now sitting since yesterday and I don't manage do validate my radiobuttons via php. It would be really great if someone could help me out...
by knallbernd
Tue Jun 26, 2007 3:09 pm
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Ok, i don't get it. I'm too silly to create a simple (in this case maybe a bit more difficult) form validation, I think I'm sitting too long behind this script. I just want to validate if every radiobutton ist set. Else the form shouldn't be send. <html> <head> </head> <form method="post" ...
by knallbernd
Tue Jun 26, 2007 12:46 pm
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Thanks, I will try that. If I don't manage to fix it I'm hopefully allowed to post again ;-).
Have a nice day!
by knallbernd
Tue Jun 26, 2007 12:27 pm
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

$valid = true; for ($i=1; $i<3; $i++ ) { $zahl = "Frage".$i; $array[$zahl] = $_POST[$zahl]; foreach ($array[$zahl] as $key => $wert) { if (empty($wert)) { $valid = false; break; } } } if ($valid) { for ($i=1; $i<3; $i++ ) { $zahl = "Frage".$i; $array[$zahl] = $_POST[$zahl]; fore...
by knallbernd
Tue Jun 26, 2007 12:05 pm
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Still the same problem...

If only one radiobutton is selected and the others not, this one will be written in the db --> but there should be no
value be written in the db, except if ALL radiobuttons are selected. Javascript is too insecure for this purpose :-(.
by knallbernd
Tue Jun 26, 2007 11:22 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Let's say I have chosen one radiobutton from 5 questions. Then this one will be written in the db --> I don't want that.
I only want to write something (or do some other script) when EVERY button is set, no matter the name or what question.
by knallbernd
Tue Jun 26, 2007 11:09 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Nearly :oops:

How can I manage to prove if ANY radiobutton is empty?

Code: Select all

$zahl = "Frage".$i; 

if ( empty($_POST[$zahl]) ){
    echo "please answer every question";
   exit;
}
This ain't working.
by knallbernd
Tue Jun 26, 2007 10:22 am
Forum: PHP - Code
Topic: [SOLVED] overwriting data in db
Replies: 31
Views: 4998

Allright! Thank you very very much for your efforts!