On Sunday 18 August 2002 13:40, Chip Wiegand wrote:

> 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());
>       }

[snip]

> But I still get empty rows inserted into the tables.

   || means OR

You want to insert a value when:

  1) $date_am has a value AND
  2) $exercise_am has a value AND
  3) $reps_am is not an empty string

so use AND or && instead of ||.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *


/*
A couch is as good as a chair.
*/


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

Reply via email to