Re: cant get if logic correct..
| From: | Jim Lucas | Date: | Wed, 15 Aug 2007 15:51:09 +0000 |
| Subject: | Re: cant get if logic correct.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-260859@lists.php.net to get a copy of this message | ||
Gregory Machin wrote:
Hi i have a piece of code that gets info from a comma delimited file, then gets each value that is to be insterted into the database .... The variabls must only contain numbers and must not be null .. but the logic i have is iether not working or there are some hidden characters creeping in because it is processing the data ... how can i do this better ? for($i=2;$i<$arrsize;$i++){ $parts=explode(",",$lines[$i]);for ( $i=2; $i<$arrsize; $i++ ) { // Explode string into what you need list($stnr, $subj, $mark) = explode(',', $lines[$i]); // Test for conditions if ( !empty($stnr) && !empty($subj) && !empty($mark) ) { // Do a lot of something lol } else { // Something was empty } } -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare$stnr=$parts[0];$subj=$parts[1]; $mark=$parts[4]; if (($stnr>"") and ($subj>"") and ($mark>"")){//do alot of something lol } }