473,503 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Content management with flat text files...

eragon
431 Contributor
i have a script that will write to a text file from a form... using php scripts.. now i need a script to call from this file line by line, or any similar way of posting it, and insert it into my php home page. i have the script set up and working, it posts a headline on say line 1, a news article on line 2, and line 3 is blank. then when i submit again it posts a headline on line 4, a news article on line 5, and line 6 is blank.

the txt file looks as so:

Expand|Select|Wrap|Line Numbers
  1. Heading 1
  2. THis is the news article asociated with heading 1. it is saved as one line in for example news.txt
  3.  
  4. Heading 2
  5. This is the news for heading 2. it was submitted by for example submit.php and is displayed on index.php in a table.
  6.  
now i want this to load as so:

[HTML]<table>
<tr><th>Heading 1</th></tr>
<tr><td>THis is the news article asociated with heading 1. it is saved as one line in for example news.txt</td></tr>
<tr><td></td></tr>
<tr><th>Heading 2</th></tr>
<tr><td>This is the news for heading 2. it was submitted by for example submit.php and is displayed on index.php in a table.</td></tr>
<tr><td></td></tr>
</table>[/HTML]

pretty simple?

just a few notes: i dont have a working mysql server, if anybody knows a free sql server that i can use that actually works, i need to have a link, otherwise i will stay with text files... help!

Sincerely,
Eragon
Jun 6 '07 #1
7 2126
jx2
228 New Member
[PHP]
<?php
$handle = @fopen("yourFile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle);
$lines[]=$buffer;
}
fclose($handle);
}
?>

[/PHP]
now you have whole file in array - $lines

i hope that help

ps: why you dont yous mysql? i know its hard to set up but you will love it!!!
Jun 6 '07 #2
pbmods
5,821 Recognized Expert Expert
MySQL is free. Unless you mean you need a free server to host the database.

A-Plus.net's Solo XR plan is at a pretty reasonable rate right now (about $7.50 per month), and you can probably find better deals. $90 per year plus domain (plus ICANN) ain't bad, plus you can host the rest of your site from that server, too.

My boss once built a 'database' using flat text files. It might be why he says he feels so old all the time (hint: he's NOT old!).
Jun 6 '07 #3
eragon
431 Contributor
can i just make a database on my computer and upload it as a file, or, does it have to be integrated with the server? i tried using *.mdb files with *.aspx files, but i couldnt get it to work right... i need anything that can help a person (me) who only knows html, javascript, some php, everything about access, lots of dreamweaver, and some japenese... any ideas, btw, how do i call the array in that code above?

what would the script look like in the news page...

[PHP]<?PHP
echo ($lines_1);
?>[/PHP]

or what??

SIncerely,

Eragon
Jun 7 '07 #4
eragon
431 Contributor
and by the way, i need free links, cuz right now alls i have in my company account is -$14, so, ya... I took out a loan from my friend to fix my router cables, geez do i hate my dog...

it seems to me everything online requires you to pay... i cant even get a decent domain name without putting myself in debt...

and im still in buisness, imagine that?
Jun 7 '07 #5
ronnil
134 Recognized Expert New Member
try setting up your own server for testing purposes, you can do that on the machine you're running.

apache server is free (and great btw), most unix based webservers are apache

IIS (Internet Information Services) is free if you have windows XP Pro (it's on your install disc)

php can be downloaded (for free) from php.net, you will also find a complete reference, very well written.

mysql is also free and can be downloaded from mysql.com

Everything is supplied with user/installation manuals and should be achievable to setup within a few hours.

if you want php to work with MS access i think you need a library to do so (this can also be gotten free of charge from somewhere)
Jun 7 '07 #6
eragon
431 Contributor
cool. i tried aspx with ms access, but the codes dreamweaver gave me dont work... :( ill look into using MySQL, even though i have no experience. is it similar to mdb?
Jun 9 '07 #7
eragon
431 Contributor
my question still remains. links to tutorials would be nice. i have decided to use sql, however, i need to know how ot use it. the web host i have has sql. i need tutorials!!!!!!!
Jun 11 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
3588
by: Jeff | last post by:
We're running a fairly busy and complex e-commerce website. It's an online retailer. We utilize MySQL for most of our site-based dynamic data, and then we use Oracle to access inventory and place...
6
1364
by: windandwaves | last post by:
Hi folk I would like to setup a website for someone where they can change some content themselves (list of concerts). The obvious choice is to use PHP and MySql, but is there a way to do it...
0
2120
by: Scott Abel | last post by:
For immediate release: The Rockley Group Content Management Workshop Series Coming to Atlanta, Seattle, Vancouver, Chicago, Washington, DC, Toronto, and Research Triangle Park Learn more:...
22
2976
by: Daniel Billingsley | last post by:
Ok, I wanted to ask this separate from nospam's ridiculous thread in hopes it could get some honest attention. VB6 had a some simple and fast mechanisms for retrieving values from basic text...
4
1704
by: Ben | last post by:
So, at my place of employment, we use a national standard to transmit data between certain applications. This standard consists of a fixed width, flat file 4500-some-odd chars wide that contain...
10
1878
by: JJ | last post by:
I am needing to write a simple content management system for my web site. I've not done this before so if anyone has any link/info please could you mention them? One thing I am confused about:...
7
1455
by: Ira.Kovac | last post by:
Hello All, I'd greatly appreciate if you can take a look at the task I need help with. It'd be outstanding if someone can provide some sample Python code. Thanks a lot, Ira
0
996
by: vayalumkan | last post by:
Hi Sir, I want some technical help on how to develop(Implement) a Content Management System using ASP.NET and C#? Can any body help me to develop a CMS (Content Management System) ? ...
15
5237
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7273
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.