View Full Version : Quick Variable Question
Colin-Roberts
11-02-2009, 09:27 PM
How would i make it so it inserts the data into the text file that matches $category.
like so:
$read = fopen("$category.txt", "r");
$contents = fread($read, filesize('$category.txt'));
but clearly proper way..
I think putting {} around the variable should make it work. so like fopen("{$category}.txt", "r") if that doesn't work, try fopen("".$category.".txt", "r")
Colin-Roberts
11-02-2009, 09:57 PM
Warning: filesize() [function.filesize (http://www.mini-roberts.com/tim/function.filesize)]: stat failed for ".$category.".txt in /home/chong08/public_html/mini-roberts.com/tim/adddef.php on line 53
Warning: fread() [function.fread (http://www.mini-roberts.com/tim/function.fread)]: Length parameter must be greater than 0 in /home/chong08/public_html/mini-roberts.com/tim/adddef.php on line 53
You changed the second line as well yeah?
Colin-Roberts
11-02-2009, 10:02 PM
yep, changed all 3 of them
Invent
11-02-2009, 10:05 PM
How would i make it so it inserts the data into the text file that matches $category.
like so:
$read = fopen("$category.txt", "r");
$contents = fread($read, filesize('$category.txt'));
but clearly proper way..
$read = fopen( $category . '.txt', 'r' );
$contents = fread( $read, filesize( $category . '.txt' ) );
well
$read = fopen("".$category.".txt", "r");
$contents = fread($read, filesize("".$category.".txt")); looks like it should work to me.. i'm not really sure how else to do it..
Colin-Roberts
11-02-2009, 10:16 PM
i'm just going do it all in mysql instead..
i'm just going do it all in mysql instead..
Much easier, nice choice.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.