in reply to Re: Admin-ing a file?
in thread Admin-ing a file?

Ooh, I guess they don't email you when you get a reply here. Sorry for the late reply; To answer some of the questions of Improv, you nailed all three of those. I am using a .dat file, like a csv file I am assuming, I'm not doing this version in mysql, and I am using p Yeerl no doubt. Ok, here is an example of my .dat file:
<!--START:--> <table width=500 border=0 cellpadding=5 cellspacing=0><tr><td>Signed o +n:&nbsp;April 23, 2003</td></tr><tr><td>Name:Devin</td></tr><tr><td>E +mail:&nbsp; <a href='mailto:'puckchewer@cs.com>puckchewer@cs.com</a>< +/td></tr><tr><td>Country:USA</td><tr><td>State/Province/Territory:&nb +sp;Colorado</td></tr><tr><td>City:&nbsp;Loveland</td></tr><tr><td>Sit +e rating:&nbsp;10</td></tr><tr><td>Comments:<br>Testing my entry for +the second time to see if the buffer turned off.</tr><tr><td></table> <!--END:--><!--START:--> <table width=500 border=0 cellpadding=5 cellspacing=0><tr><td>Signed o +n:&nbsp;April 23, 2003</td></tr><tr><td>Name:Devin</td></tr><tr><td>E +mail:&nbsp; <a href='mailto:'puckchewer@cs.com>puckchewer@cs.com</a>< +/td></tr><tr><td>Country:USA</td><tr><td>State/Province/Territory:&nb +sp;Colorado</td></tr><tr><td>City:&nbsp;Loveland</td></tr><tr><td>Sit +e rating:&nbsp;10</td></tr><tr><td>Comments:<br>Testing my entry</tr> +<tr><td></table> <!--END:-->
Yes, I am completely aware that I should generate my HTML on the fly but I haven't had time to re-write the script in order to do that. My main problems are figuring out what I need to do to manipulate the strings (I'm sure I'm just thinking too hard) in order to break them into their separate messages. If you could possible give me what you would normally do in a case like this, that would definitely help.

Replies are listed 'Best First'.
Re: Re: Re: Admin-ing a file?
by Improv (Pilgrim) on Apr 24, 2003 at 14:12 UTC
    Actually, there's a preference you can set in your profile that will at least make replies show up. Anyhow, yeah, this doesn't look like the easiest format to parse, because your data is all mixed into the HTML. The easiest way to deal with this, IMO, is to parse the whole thing into memory, and write it all back out if there are changes. Unfortunately, this is also slow, but at least the code will be clean. Here's code to do it:
      I agree. This flat file crap isn't cutting it. MySQL is so undbelieveably better. Thanks, I'll take a look at that and I'll get this into a db soon.