Minimeallolla Posted November 12, 2010 Share Posted November 12, 2010 the files are created upon registration. just i get this error.. Warning: include(1) [function.include]: failed to open stream: No such file or directory in /home/bob/public_html/mysite/profiles/write.php on line 129 Warning: include(1) [function.include]: failed to open stream: No such file or directory in /home/bob/public_html/mysite/profiles/write.php on line 129 Warning: include() [function.include]: Failed opening '1' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/bob/public_html/mysite/profiles/write.php on line 129 $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) $filename = "/home/bob/public_html/mysite/profiles/profileinfo/$username.info.php" or exit("Unable to open file!"); $handle = fopen($filename, 'w')or die; $content = "<b>Firstname: </b>$firstname <br> <b> Lastname: </b> $lastname <p> <b> Birthday: </b>$day $month $year <br> <b> Location: </b> $location"; fwrite($handle, $content)or die; fclose($handle); } $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) include ("/home/bob/public_html/mysite/profiles/profileinfo/$username.info.php")or die; Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/ Share on other sites More sharing options...
jdavidbakr Posted November 12, 2010 Share Posted November 12, 2010 So ... is there a file at /home/bob/public_html/mysite/profiles/write.php? Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/#findComment-1133483 Share on other sites More sharing options...
Minimeallolla Posted November 12, 2010 Author Share Posted November 12, 2010 yes but i think i got the directory wrong or something its in /profiles/profileinfo/$username.info.php Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/#findComment-1133486 Share on other sites More sharing options...
jdavidbakr Posted November 12, 2010 Share Posted November 12, 2010 Your answer is on line 129, whatever is causing the filename to be /home/bob/public_html/mysite/profiles/write.php instead of what you're expecting it to be. Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/#findComment-1133488 Share on other sites More sharing options...
Minimeallolla Posted November 12, 2010 Author Share Posted November 12, 2010 line 129 is include ("/home/giacjrdi/public_html/mysite/profiles/profileinfo/$username.info.php")or die; Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/#findComment-1133497 Share on other sites More sharing options...
litebearer Posted November 12, 2010 Share Posted November 12, 2010 1. ALWAYS test your variable to make sure they contain what you expect them to contain. 2. Try this... $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); $num_rows = mysql_num_rows($result); if($num_rows>0) { while($info = mysql_fetch_array( $check )) { $filename = "/home/bob/public_html/mysite/profiles/profileinfo/" . $username . ".info.php"; $handle = fopen($filename, 'w'); $content = "<b>Firstname: </b>" . $info['firstname <br> "; $content = $content . "<b> Lastname: </b>" . $info['lastname <p> "; $content = $content . "<b> Birthday: </b>" . $info['day'] . " " . $info['month'] . $info['year'] . " <br> " $content = $content . "<b> Location: </b> " . $info['location']; fwrite($handle, $content)or die; fclose($handle); } include ($filename); }else{ echo "NOT FOUND"; } Link to comment https://forums.phpfreaks.com/topic/218497-need-help-with-php-editing-files/#findComment-1133500 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.