Re: [PHP] How to jump to line number in large file

2008-04-05 Thread Steve McGill
Thanks for the heads up on fgetc() incrementing by one. I hadn't actually tested that code yet, I was using the original fseek($handle,$pos). strpos would be ideal but it needs to work on a string and not a file - I don't want to load a 100Mb file into memory if I don't have to. Perhaps I

Re: [PHP] How to jump to line number in large file

2008-04-05 Thread Steve McGill
Richard Heyes [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks for the heads up on fgetc() incrementing by one. I hadn't actually tested that code yet, I was using the original fseek($handle,$pos). strpos would be ideal but it needs to work on a string and not a file - I

Re: [PHP] How to jump to line number in large file

2008-04-05 Thread Steve McGill
So the only variation on a theme that I didn't test is the one that performs the best by an order of magnitude... nice. Many thanks for your time everyone. Robert Cummings [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sat, 2008-04-05 at 19:09 +0100, Steve McGill wrote

[PHP] How to jump to line number in large file

2008-04-04 Thread Steve McGill
Hello, I have code where it is appropriate for me to jump to certain lines in a text file and edit that particular line. I need to keep a record of the byte position of every line so that I can fseek to it. I need to do in-line editing so I don't want to write the entire file out again etc. I

[PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread Steve McGill
;$i100;$i++) { // do something standard } ? as I would have have to either keep two copies of the code or write a function just for this purpose, which hardly seems worth it. Thanks to anyone who takes the time to think about my question and/or respond. Best wishes, Steve McGill

Re: [PHP] HTTP User Authentication Problems

2005-12-06 Thread Steve McGill
Hi Rahul, Try doing a print_r($_SERVER) to see if the variables are being set. If they aren't, take a look at the phpinfo(); - chances are your host is using a CGI binary version of PHP to use together with a security wrapper like suPHP or phpSuExec, which might throw away the variables that

Re: [PHP] Unnecessary if statement? Programming technique

2005-12-06 Thread Steve McGill
Hi, David is right about the unwanted side-effect. Thanks for the idea though. Unfortunately the 'greater problem' is not so great, I've just been doing this for a while now and find myself programming loops like these so often and I've never got round to testing if a simple IF statement is a

[PHP] PHP + Javascript, immediate database update

2004-10-27 Thread Steve McGill
Hi everyone, I have a webform which my users are expecting to act like a Windows program, they only need to check the box and it is automatically written to the database. So I'd like to use a combination of javascript, like this, but it isn't quite elegent enough: - Tick the box. - Javascript

[PHP] Most efficient way of fetching 1,000 records from MySQL ?

2004-10-25 Thread Steve McGill
? Many thanks in advance for your help. Steve McGill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Most efficient way of fetching 1,000 records from MySQL ?

2004-10-25 Thread Steve McGill
I think you'll find that your first approach is not only more correct, it's the only manageable one. No, it will be very slow. The biggest overhead is in transfering data to and from sql server. It's always better to get the results in one sql query. Use this aproach: $users =