cluce Posted September 25, 2008 Share Posted September 25, 2008 $handle = fopen("EmployeeLoginInfoRev2.csv","r"); while(($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $username = $data[0]; $password = $data[1]; $f_name = $data[2]; $l_name = $data[3]; $email = $data[4]; $last = $data[5]; $failed = $data[6]; $priv = $data[7]; $company = $data[8]; $division_number = $data[9]; $sql = "INSERT INTO employees (username, password, f_name, l_name, email, last_login, failed_logins, privilege, company, division_number) VALUES ('$username', '$password', '$f_name', '$l_name', '$email', '$last', '$failed', '$priv', '$company', '$division_number')"; mysqli_query($mysqli, $sql); $counter++; echo 'SQL='.$sql.'<br/>'; while(($data = fgetcsv($handle, 1000, ",")) !== FALSE) What does this statement mean? Quote Link to comment Share on other sites More sharing options...
Adam Posted September 25, 2008 Share Posted September 25, 2008 Good explanation of the function used here: http://uk3.php.net/fgetcsv But.. basically while the variable $data still reads from the csv file and does not = false, do that code... Quote Link to comment Share on other sites More sharing options...
Push Eject Posted September 25, 2008 Share Posted September 25, 2008 The reason for "!== false" instead of "!= false" is a statement can evaluate to 0 and still be true. e.g. $found = strpos( "Hello World!", "H") Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.