JREAM Posted August 23, 2008 Share Posted August 23, 2008 Hey, I have this an I am trying to do an elseif when the write doesn't go through, I tried doing else after it but it always appears, I tried elseif (!fwrite($fp)) {echo "error";} but that doesnt work if ($_POST['submit'] && $pw1 == $pw2 && $pw1 >= 6) { $thefile = 'pw.php'; $fp = fopen($thefile, 'w'); $loginwrite = $login; $passwrite = base64_encode($pw1); fwrite($fp, $loginwrite . '|' . $passwrite); fclose($fp); MsgBox(lt(" <strong>Your Login/Password was Saved, Please remember it. <br />This is an encrypted data, if you lose your info please contact technical support. ",'areas-save-success' )); } else {// Why does this always show} Link to comment https://forums.phpfreaks.com/topic/121017-solved-elseif-fwrite/ Share on other sites More sharing options...
Fadion Posted August 23, 2008 Share Posted August 23, 2008 fwrite() returns the amount of data that was written, or if it failed, false. Like this: <?php $fp = fopen($thefile, 'w'); $write = fwrite($fp, 'somedata'); if($write == false){ echo 'Error writing'; } ?> Link to comment https://forums.phpfreaks.com/topic/121017-solved-elseif-fwrite/#findComment-623855 Share on other sites More sharing options...
ignace Posted August 23, 2008 Share Posted August 23, 2008 $pw1 >= 6 should strlen($pw1) >= 6 MsgBox()? visual basic developer? Link to comment https://forums.phpfreaks.com/topic/121017-solved-elseif-fwrite/#findComment-623856 Share on other sites More sharing options...
JREAM Posted August 23, 2008 Author Share Posted August 23, 2008 Oh I see silly me haha $pw1 >= 6 should strlen($pw1) >= 6 MsgBox()? visual basic developer? Old Habits die hard Link to comment https://forums.phpfreaks.com/topic/121017-solved-elseif-fwrite/#findComment-623861 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.