Jump to content

need help with php editing files


Minimeallolla

Recommended Posts

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

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";
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.