Re: [PHP-DB] Problem with php and mysql

2003-03-05 Thread 1LT John W. Holmes
 One of our customers has written a php application that we are hosting.

 Basically, there is a province/state table which populates a combo box.
 When the form containing this combo box is submitted, the information is
 added into the database.

 The problem is that when nothing is selected from the combo box, it adds a
 number which seems to be random in the database, rather than the
 province/state ID which it references from the province table. Obviously
 there are many methods of avoiding this such as javascript to make sure
 something is selected, or even giving the combo box a default value, but I
 was wondering if anyone knew why the database itself isn't catching the
 error (foreign key violation) and accepting the data.

 Any ideas?

Are you using InnoDb tables? Otherwise there are no foreign key
restrictions.

How about some validation to make sure something is selected? Or, some
validation that'll give the value a default if nothing is selected.

Validate everything from the user!

---John Holmes...


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Problem with php and mysql

2003-03-05 Thread Kevin Demers DSL
Hi, thanks for the help, I just had a look at the db and they are just the
default tables, so that must be it. I'll let them know to either change
them over or add validation.

Again, thanks for your help.

On Wed, 5 Mar 2003, 1LT John W. Holmes wrote:

 Date: Wed, 5 Mar 2003 10:07:04 -0500
 From: 1LT John W. Holmes [EMAIL PROTECTED]
 To: Kevin Demers DSL [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: [PHP-DB] Problem with php and mysql

  One of our customers has written a php application that we are hosting.
 
  Basically, there is a province/state table which populates a combo box.
  When the form containing this combo box is submitted, the information is
  added into the database.
 
  The problem is that when nothing is selected from the combo box, it adds a
  number which seems to be random in the database, rather than the
  province/state ID which it references from the province table. Obviously
  there are many methods of avoiding this such as javascript to make sure
  something is selected, or even giving the combo box a default value, but I
  was wondering if anyone knew why the database itself isn't catching the
  error (foreign key violation) and accepting the data.
 
  Any ideas?

 Are you using InnoDb tables? Otherwise there are no foreign key
 restrictions.

 How about some validation to make sure something is selected? Or, some
 validation that'll give the value a default if nothing is selected.

 Validate everything from the user!

 ---John Holmes...



Thanks,
Kevin

---
   Kevin Demers
 Technical/Customer Support
Internet Access - WORLDWIDE
3 East Main Street
Welland, ON  Canada L3B 3W4
(905) 714-1400   (800) 560-4560
[EMAIL PROTECTED] www.iaw.on.ca


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php