Thanks, I tried the trim function and it solves most of my problems, but I still get duplicates........it's so weird, could any1 please just quickly check through these lines of code and tell me if you see anything thats wrong....
The records in the dbase are uploaded with another php file, which does just that, no problem over there....this problem is given even if I upload the same file to the dbase, it's then supposed to not display anything on screen, cause all records exists allready, but it displays a whole lists of supposedly new records...?? Here is the code that's giving the problem: /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++ +++++++++++++++++++++ checking for new records, not yet in dbase... ++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++*/ $lines = file ('../includes/new1.csv'); foreach ($lines as $line_num => $line) { list($npr_nr,$npr_exvat,$npr_desc) = explode(",",$line); $npr_nr = trim($npr_nr, " "); $query = "SELECT product_id, product_nr from products"; $currentprs = mysql_query ($query, $db_connection) or die (mysql_error()); while (list ($currentprs_id, $currentprs_nr) = mysql_fetch_row ($currentprs)) { if ($npr_nr == $currentprs_nr) { mysql_query ("DELETE from tmpprods where product_nr = '$currentprs_nr'",$db_connection) or die (mysql_error()); } // end if } // end while } // end foreach /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++ +++++++++++++++++++++ Finish checking for new records, not yet in dbase... +++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++*/ Thanks again Adriaan "- Edwin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > "Adriaan Nel" <[EMAIL PROTECTED]> wrote: > > > Do any1 know how I can check for spaces here, > > and remove them if present???? > > http://www.php.net/manual/en/function.trim.php ? > http://www.php.net/manual/en/function.rtrim.php ? > http://www.php.net/manual/en/function.lrim.php ? > > - E > > __________________________________________________ > Do You Yahoo!? > Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php