does it possible

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
mohsin360
Forum Newbie
Posts: 18
Joined: Sat Aug 15, 2009 2:39 am

does it possible

Post by mohsin360 »

i want to make a web of computers which having thumbs and prices and product name and no .my client is a lammer like me so i want to make it from the function include so he can edit the prices and product numbers by just editing notepad files by using include function .the problem is that web contain a lot of categories and a lot of products if i use include function for each one there are so many notepad files require all i need is can i use explode function with in include function so there is one file for each category and i can include its lines or coma seperated values to include?sory for poor english
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: does it possible

Post by Jonah Bron »

Yes, you can use explode() on it. But you won't use include, you'd use file().

http://php.net/file

File() loads the file, and splits it into an array at each line.
mohsin360
Forum Newbie
Posts: 18
Joined: Sat Aug 15, 2009 2:39 am

Re: does it possible

Post by mohsin360 »

$file = explode("\n", file_get_contents('txtfile.txt'));

echo $file[2];
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: does it possible

Post by AbraCadaver »

mohsin360 wrote:$file = explode("\n", file_get_contents('txtfile.txt'));

echo $file[2];
Or as Jonah said:

Code: Select all

$lines = file('txtfile.txt');
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply