Re: oddity with insert multiple input fields to multipletables

From: Date: Sun, 18 Aug 2002 05:40:52 +0000
Subject: Re: oddity with insert multiple input fields to multipletables
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-21208@lists.php.net to get a copy of this message
On Sat, 2002-08-17 at 21:25, Jason Wong wrote: > You have to check them before inserting. > > if ($value !== "") { > insert_value(); > } > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Okay, so I tried this - if ($date_am || $exercise_am || $reps_am !== "") { $sql_am = "insert into absmachine (today,exercise,reps,comments) values ('$date_am','$exercise_am','$reps_am','$comments_am')"; mysql_query($sql_am) or die ("Error in this query >>$sql<< : " .mysql_error()); } and this - $sql_am = "insert into absmachine (today,exercise,reps,comments) values ('$date_am','$exercise_am','$reps_am','$comments_am')"; if ($date_am || $exercise_am || $reps_am !== "") { mysql_query($sql_am) or die ("Error in this query >>$sql<< : " .mysql_error()); } But I still get empty rows inserted into the tables. -- Chip > > > -----Original Message----- > > > From: Chip Wiegand [mailto:chip@wiegand.org] > > > Sent: Sunday, 18 August 2002 7:08 AM > > > To: phpdb > > > Subject: [PHP-DB] oddity with insert multiple input fields to multiple > > > tables > > > > > > > > > > > > I have a web page interface to a mysql database. In this web page I have > > > about a dozen form input fields. On submit these are submitted to > > > multiple tables, a differant table for each input field. If I leave any > > > fields blank, and insert only some of the fields, the database will > > > insert an empty row to all the effected tables that didn't have any data > > > from the input fields. > > > > > > > > > I have another page that generates graphs from the tables, the empty > > > rows show up as breaks in the graphs lines, if I manually delete all the > > > empty rows the graphs work fine. > > > > > > > > > > > > What do I need to do to prevent these empty rows from being written to > > > the tables? > > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > > /* > Between grand theft and a legal fee, there only stands a law degree. > */ > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.db (#21208) next »