Re: [PHP] Garbage Collection

2009-02-06 Thread Shawn McKenzie
Frank Stanovcak wrote:
> ""Boyd, Todd M.""  wrote in message 
> news:33bde0b2c17eef46acbe00537cf2a19003cb4...@exchcluster.ccis.edu...
>> -Original Message-
>> From: tedd [mailto:t...@sperling.com]
>> Sent: Thursday, February 05, 2009 10:07 AM
>> To: php-general@lists.php.net
>> Subject: [PHP] Garbage Collection
>>
>> Hi gang:
>>
>> A related question to my last "Clarity needed" post.
>>
>> I have a tutor table (showing all the tutors), a course table
>> (showing all the courses), and a course-to-tutor table (showing all
>> the instances of what tutor teaches what course).
>>
>> Okay, everything works. Whenever I want to find out what courses a
>> specific tutor teaches OR what tutors teach a specific course, I
>> simply search the course-to-tutor table and bingo out pops the answer.
>>
>> Now, how do you handle the situation when a tutor quits or when a
>> course is no longer offered?
>>
>> If I search the course-to-tutor table for all the tutors who teach a
>> course and find a tutor who is no longer there OR search the
>> course-to-tutor table for all the courses a tutor teaches and find a
>> course that is no longer offered, how do you handle the record?
>>
>> I realize that if either search turns up nothing, I can check for
>> that situation and then handle it accordingly. But my question is
>> more specifically, in the event of a tutor quilting OR removing a
>> course from the curriculum, what do you do about the course-to-tutor
>> orphaned record?
>>
>> As I see it, my choices are to a) ignore the orphaned record or b)
>> delete the orphaned record. If I ignore the record, then the database
>> grows with orphaned records and searches are slowed. If I delete the
>> orphaned record, then the problem is solved, right?
>>
>> I just want to get a consensus of how you people normally handle it.
>> Do any of you see in danger in deleting an orphaned record?
> 
> tedd,
> 
> I believe relational integrity can solve your problem. In MySQL (and
> maybe MSSQL, but I am less "versed" with that product) you should be
> able to put a CASCADE option on the DELETE action for your tutor table
> so that when a record is deleted, its associated record in
> tutors-to-courses is also deleted. I'm assuming you would want to do the
> same for removing a record in tutors-to-courses when a course is removed
> (but not remove the tutor, the same as you do not remove the course
> itself when the tutor is deleted).
> 
> I suppose you could also do it yourself with PHP code when a failed link
> is turned up, but why bother separating DB logic from the DB itself? :)
> 
> HTH,
> 
> 
> // Todd
> 
> I agree with todd.  Set up the relationship so that when a record in one of 
> the two master tables is deleted the delete cascades to the linked table. 
> One to many forced update/delete I think it's called if you want to do a 
> search on it.
> 
> Frank 
> 
> 
Yes, and you haven't tried it, MySQL Workbench is very handy for
designing DBs.  It was Windows only, but they now have a beta out for
Linux and it seems to work fine.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-06 Thread Frank Stanovcak

""Boyd, Todd M.""  wrote in message 
news:33bde0b2c17eef46acbe00537cf2a19003cb4...@exchcluster.ccis.edu...
> -Original Message-
> From: tedd [mailto:t...@sperling.com]
> Sent: Thursday, February 05, 2009 10:07 AM
> To: php-general@lists.php.net
> Subject: [PHP] Garbage Collection
>
> Hi gang:
>
> A related question to my last "Clarity needed" post.
>
> I have a tutor table (showing all the tutors), a course table
> (showing all the courses), and a course-to-tutor table (showing all
> the instances of what tutor teaches what course).
>
> Okay, everything works. Whenever I want to find out what courses a
> specific tutor teaches OR what tutors teach a specific course, I
> simply search the course-to-tutor table and bingo out pops the answer.
>
> Now, how do you handle the situation when a tutor quits or when a
> course is no longer offered?
>
> If I search the course-to-tutor table for all the tutors who teach a
> course and find a tutor who is no longer there OR search the
> course-to-tutor table for all the courses a tutor teaches and find a
> course that is no longer offered, how do you handle the record?
>
> I realize that if either search turns up nothing, I can check for
> that situation and then handle it accordingly. But my question is
> more specifically, in the event of a tutor quilting OR removing a
> course from the curriculum, what do you do about the course-to-tutor
> orphaned record?
>
> As I see it, my choices are to a) ignore the orphaned record or b)
> delete the orphaned record. If I ignore the record, then the database
> grows with orphaned records and searches are slowed. If I delete the
> orphaned record, then the problem is solved, right?
>
> I just want to get a consensus of how you people normally handle it.
> Do any of you see in danger in deleting an orphaned record?

tedd,

I believe relational integrity can solve your problem. In MySQL (and
maybe MSSQL, but I am less "versed" with that product) you should be
able to put a CASCADE option on the DELETE action for your tutor table
so that when a record is deleted, its associated record in
tutors-to-courses is also deleted. I'm assuming you would want to do the
same for removing a record in tutors-to-courses when a course is removed
(but not remove the tutor, the same as you do not remove the course
itself when the tutor is deleted).

I suppose you could also do it yourself with PHP code when a failed link
is turned up, but why bother separating DB logic from the DB itself? :)

HTH,


// Todd

I agree with todd.  Set up the relationship so that when a record in one of 
the two master tables is deleted the delete cascades to the linked table. 
One to many forced update/delete I think it's called if you want to do a 
search on it.

Frank 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-05 Thread Paul M Foster
On Thu, Feb 05, 2009 at 02:48:14PM -0500, tedd wrote:

> At 7:03 PM + 2/5/09, Nathan Rixham wrote:
>> IMHO forget the active flag, replace it with a field "deleted" which
>> is a timestamp, then you've got an audit trail of when the it was
>> removed :)
>>
>> infact often seen three fields on every table, "inserted, updated
>> and deleted" all timestamps and self explanatory.
>
> Nathan:
>
> As usual, you (and others on this list) have clarity on this.
>
> I think I'll go your route except I'll have a "date created" and
> "date inactive" field but not a "date updated" field.
>
> In this situation there would never be a reason for an update. After
> all, the tutor_course record is created when an assignment is made --
> when the assignment is broken, then the record becomes inactive. So,
> there's no reason to update. "Do, or don't do, there is no try." --
> Yoda

Actually, if I needed a history, I wouldn't do it with timestamp fields
in the table. I'd build a new file that contained the history. Maybe

when timestamp
operation char(1)
what char(1)
which id

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-05 Thread tedd

At 7:03 PM + 2/5/09, Nathan Rixham wrote:
IMHO forget the active flag, replace it with a field "deleted" which 
is a timestamp, then you've got an audit trail of when the it was 
removed :)


infact often seen three fields on every table, "inserted, updated 
and deleted" all timestamps and self explanatory.


Nathan:

As usual, you (and others on this list) have clarity on this.

I think I'll go your route except I'll have a "date created" and 
"date inactive" field but not a "date updated" field.


In this situation there would never be a reason for an update. After 
all, the tutor_course record is created when an assignment is made -- 
when the assignment is broken, then the record becomes inactive. So, 
there's no reason to update. "Do, or don't do, there is no try." -- 
Yoda


Thanks,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-05 Thread Nathan Rixham

Dan Shirah wrote:

Hi gang:

A related question to my last "Clarity needed" post.

I have a tutor table (showing all the tutors), a course table (showing all
the courses), and a course-to-tutor table (showing all the instances of what
tutor teaches what course).

Okay, everything works. Whenever I want to find out what courses a specific
tutor teaches OR what tutors teach a specific course, I simply search the
course-to-tutor table and bingo out pops the answer.

Now, how do you handle the situation when a tutor quits or when a course is
no longer offered?

If I search the course-to-tutor table for all the tutors who teach a course
and find a tutor who is no longer there OR search the course-to-tutor table
for all the courses a tutor teaches and find a course that is no longer
offered, how do you handle the record?

I realize that if either search turns up nothing, I can check for that
situation and then handle it accordingly. But my question is more
specifically, in the event of a tutor quilting OR removing a course from the
curriculum, what do you do about the course-to-tutor orphaned record?

As I see it, my choices are to a) ignore the orphaned record or b) delete
the orphaned record. If I ignore the record, then the database grows with
orphaned records and searches are slowed. If I delete the orphaned record,
then the problem is solved, right?

I just want to get a consensus of how you people normally handle it. Do any
of you see in danger in deleting an orphaned record?

Cheers,

tedd


I guess that all depends.

If you want some kind of historical log of what tutor taught which course
and which courses have previously been offered then I wouldn't delete the
records.  Instead I would and something like a "Active" column and use
simple "Y" and "N" vaules to mark each tutor or course as active and then
just re-write your query to only pull tutor's/courses with the "Y" flag.
That would give you a current listing of active courses and who teaches
them, and also retain the historical data if it need to be referenced later.



IMHO forget the active flag, replace it with a field "deleted" which is 
a timestamp, then you've got an audit trail of when the it was removed :)


infact often seen three fields on every table, "inserted, updated and 
deleted" all timestamps and self explanatory.


regards!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-05 Thread Bastien Koert
On Thu, Feb 5, 2009 at 11:10 AM, Eric Butera  wrote:

> On Thu, Feb 5, 2009 at 11:06 AM, tedd  wrote:
> > Hi gang:
> >
> > A related question to my last "Clarity needed" post.
> >
> > I have a tutor table (showing all the tutors), a course table (showing
> all
> > the courses), and a course-to-tutor table (showing all the instances of
> what
> > tutor teaches what course).
> >
> > Okay, everything works. Whenever I want to find out what courses a
> specific
> > tutor teaches OR what tutors teach a specific course, I simply search the
> > course-to-tutor table and bingo out pops the answer.
> >
> > Now, how do you handle the situation when a tutor quits or when a course
> is
> > no longer offered?
> >
> > If I search the course-to-tutor table for all the tutors who teach a
> course
> > and find a tutor who is no longer there OR search the course-to-tutor
> table
> > for all the courses a tutor teaches and find a course that is no longer
> > offered, how do you handle the record?
> >
> > I realize that if either search turns up nothing, I can check for that
> > situation and then handle it accordingly. But my question is more
> > specifically, in the event of a tutor quilting OR removing a course from
> the
> > curriculum, what do you do about the course-to-tutor orphaned record?
> >
> > As I see it, my choices are to a) ignore the orphaned record or b) delete
> > the orphaned record. If I ignore the record, then the database grows with
> > orphaned records and searches are slowed. If I delete the orphaned
> record,
> > then the problem is solved, right?
> >
> > I just want to get a consensus of how you people normally handle it. Do
> any
> > of you see in danger in deleting an orphaned record?
> >
> > Cheers,
> >
> > tedd
> >
> > --
> > ---
> > http://sperling.com  http://ancientstones.com  http://earthstones.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Could add a status flag to the records to indicate if they're active
> or not.  Or you could use InnoDB and have it cascade delete join
> records.  Status is nice though in case they come back or to provide
> an undelete type functionality.
>
> --
> http://www.voom.me | EFnet: #voom
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
this gets my vote

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Garbage Collection

2009-02-05 Thread Dan Shirah
>
> Hi gang:
>
> A related question to my last "Clarity needed" post.
>
> I have a tutor table (showing all the tutors), a course table (showing all
> the courses), and a course-to-tutor table (showing all the instances of what
> tutor teaches what course).
>
> Okay, everything works. Whenever I want to find out what courses a specific
> tutor teaches OR what tutors teach a specific course, I simply search the
> course-to-tutor table and bingo out pops the answer.
>
> Now, how do you handle the situation when a tutor quits or when a course is
> no longer offered?
>
> If I search the course-to-tutor table for all the tutors who teach a course
> and find a tutor who is no longer there OR search the course-to-tutor table
> for all the courses a tutor teaches and find a course that is no longer
> offered, how do you handle the record?
>
> I realize that if either search turns up nothing, I can check for that
> situation and then handle it accordingly. But my question is more
> specifically, in the event of a tutor quilting OR removing a course from the
> curriculum, what do you do about the course-to-tutor orphaned record?
>
> As I see it, my choices are to a) ignore the orphaned record or b) delete
> the orphaned record. If I ignore the record, then the database grows with
> orphaned records and searches are slowed. If I delete the orphaned record,
> then the problem is solved, right?
>
> I just want to get a consensus of how you people normally handle it. Do any
> of you see in danger in deleting an orphaned record?
>
> Cheers,
>
> tedd
>
I guess that all depends.

If you want some kind of historical log of what tutor taught which course
and which courses have previously been offered then I wouldn't delete the
records.  Instead I would and something like a "Active" column and use
simple "Y" and "N" vaules to mark each tutor or course as active and then
just re-write your query to only pull tutor's/courses with the "Y" flag.
That would give you a current listing of active courses and who teaches
them, and also retain the historical data if it need to be referenced later.

If you don't care about historical data, you could just do a DELETE FROM
my_table where course/tutor id = "x"

But I would recreate an index on the table after deletion of records to keep
the speed crisp.

Dan


RE: [PHP] Garbage Collection

2009-02-05 Thread Boyd, Todd M.
> -Original Message-
> From: tedd [mailto:t...@sperling.com]
> Sent: Thursday, February 05, 2009 10:07 AM
> To: php-general@lists.php.net
> Subject: [PHP] Garbage Collection
> 
> Hi gang:
> 
> A related question to my last "Clarity needed" post.
> 
> I have a tutor table (showing all the tutors), a course table
> (showing all the courses), and a course-to-tutor table (showing all
> the instances of what tutor teaches what course).
> 
> Okay, everything works. Whenever I want to find out what courses a
> specific tutor teaches OR what tutors teach a specific course, I
> simply search the course-to-tutor table and bingo out pops the answer.
> 
> Now, how do you handle the situation when a tutor quits or when a
> course is no longer offered?
> 
> If I search the course-to-tutor table for all the tutors who teach a
> course and find a tutor who is no longer there OR search the
> course-to-tutor table for all the courses a tutor teaches and find a
> course that is no longer offered, how do you handle the record?
> 
> I realize that if either search turns up nothing, I can check for
> that situation and then handle it accordingly. But my question is
> more specifically, in the event of a tutor quilting OR removing a
> course from the curriculum, what do you do about the course-to-tutor
> orphaned record?
> 
> As I see it, my choices are to a) ignore the orphaned record or b)
> delete the orphaned record. If I ignore the record, then the database
> grows with orphaned records and searches are slowed. If I delete the
> orphaned record, then the problem is solved, right?
> 
> I just want to get a consensus of how you people normally handle it.
> Do any of you see in danger in deleting an orphaned record?

tedd,

I believe relational integrity can solve your problem. In MySQL (and
maybe MSSQL, but I am less "versed" with that product) you should be
able to put a CASCADE option on the DELETE action for your tutor table
so that when a record is deleted, its associated record in
tutors-to-courses is also deleted. I'm assuming you would want to do the
same for removing a record in tutors-to-courses when a course is removed
(but not remove the tutor, the same as you do not remove the course
itself when the tutor is deleted).

I suppose you could also do it yourself with PHP code when a failed link
is turned up, but why bother separating DB logic from the DB itself? :)

HTH,


// Todd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection

2009-02-05 Thread Eric Butera
On Thu, Feb 5, 2009 at 11:06 AM, tedd  wrote:
> Hi gang:
>
> A related question to my last "Clarity needed" post.
>
> I have a tutor table (showing all the tutors), a course table (showing all
> the courses), and a course-to-tutor table (showing all the instances of what
> tutor teaches what course).
>
> Okay, everything works. Whenever I want to find out what courses a specific
> tutor teaches OR what tutors teach a specific course, I simply search the
> course-to-tutor table and bingo out pops the answer.
>
> Now, how do you handle the situation when a tutor quits or when a course is
> no longer offered?
>
> If I search the course-to-tutor table for all the tutors who teach a course
> and find a tutor who is no longer there OR search the course-to-tutor table
> for all the courses a tutor teaches and find a course that is no longer
> offered, how do you handle the record?
>
> I realize that if either search turns up nothing, I can check for that
> situation and then handle it accordingly. But my question is more
> specifically, in the event of a tutor quilting OR removing a course from the
> curriculum, what do you do about the course-to-tutor orphaned record?
>
> As I see it, my choices are to a) ignore the orphaned record or b) delete
> the orphaned record. If I ignore the record, then the database grows with
> orphaned records and searches are slowed. If I delete the orphaned record,
> then the problem is solved, right?
>
> I just want to get a consensus of how you people normally handle it. Do any
> of you see in danger in deleting an orphaned record?
>
> Cheers,
>
> tedd
>
> --
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Could add a status flag to the records to indicate if they're active
or not.  Or you could use InnoDB and have it cascade delete join
records.  Status is nice though in case they come back or to provide
an undelete type functionality.

-- 
http://www.voom.me | EFnet: #voom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Garbage Collection

2009-02-05 Thread tedd

Hi gang:

A related question to my last "Clarity needed" post.

I have a tutor table (showing all the tutors), a course table 
(showing all the courses), and a course-to-tutor table (showing all 
the instances of what tutor teaches what course).


Okay, everything works. Whenever I want to find out what courses a 
specific tutor teaches OR what tutors teach a specific course, I 
simply search the course-to-tutor table and bingo out pops the answer.


Now, how do you handle the situation when a tutor quits or when a 
course is no longer offered?


If I search the course-to-tutor table for all the tutors who teach a 
course and find a tutor who is no longer there OR search the 
course-to-tutor table for all the courses a tutor teaches and find a 
course that is no longer offered, how do you handle the record?


I realize that if either search turns up nothing, I can check for 
that situation and then handle it accordingly. But my question is 
more specifically, in the event of a tutor quilting OR removing a 
course from the curriculum, what do you do about the course-to-tutor 
orphaned record?


As I see it, my choices are to a) ignore the orphaned record or b) 
delete the orphaned record. If I ignore the record, then the database 
grows with orphaned records and searches are slowed. If I delete the 
orphaned record, then the problem is solved, right?


I just want to get a consensus of how you people normally handle it. 
Do any of you see in danger in deleting an orphaned record?


Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage collection and strange session behaviour

2006-06-04 Thread Rasmus Lerdorf
Are you actually hitting this race condition in the real world?  With a 
decently long maxlifetime setting I can't really see this being a 
realistic problem.  Remember the timer is reset on every access.


-Rasmus

BNR - IT Department wrote:

Hi,
Here is a simple script:

".session_id()." -that's our session id, hmmm");
?> // END OF A SCRIPT

The lines from #1 to #3 intentionally set these parameters to the garbage 
collector just to speed up the results of the problem.

#4 - we're sleeping 

So, after first run we have: after #5 - a new session, #7 puts a variable 
in the session and #8 tells us about that.

After #5 we also have the session file "/tmp/sess_?" written out
there anywhere.

On second run after #5 (we've been sleeping enough on #4 to have our
session announced "old", "...dead-man-walking..." - quotation from 'The
Green Mile' movie), the gc-monster is awaken and hungry for eating "old"
session files. Finally we have the session file "/tmp/sess_?" deleted 
by the garbage collector after #5.

That's guaranteed by #1 - #4.

[If we put another 'sleep' after "/* #5 */session_start()",
we may have time to switch to '/tmp' directory and persuade ourselves
that there is no session file any more after the execution of #5.]

No session file - no session variables anymore, no session at all???
WRONG ANSWER!
We are sent to the 'else' clause, so "$_SESSION['a_sess_string]" is set
and alive , and its value - additionally - is the one before the session
file has gone (deleted) - "abcd" in my example.

Obviously 'session_start()' first fills all of the sesion variables into
memory, and after that shoots the garbage collector to go to finish its
cleaning work. The session file is deleted, but inside the session, in
our script, we are not acquainted with that... Until the end of script we 
are happy that everything is all right, but probably this self-confidence 
could lead us to some troubles later.


Is there a workaround? Without going to the file system to check if the
file still exists? A smart and elegant PHP session way, without any
if-file-exists-checking functions?

P.S. (To the administrators/moderators/whatever of this mailing list) - Please 
tell the people - write it somewhere on http://www.php.net/mailing-lists.php - 
that there is no chance to get subscribed if they are using any public mail 
address like @yahoo.com. It took me 2 days, I struggled like a pig with a 
pumpkin to find out...

-
Bulgarian National Radio
IT Department
(+359 2) 9336 615
BNR - Sofia, Bulgaria



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Garbage collection and strange session behaviour

2006-06-04 Thread BNR - IT Department
Hi,
Here is a simple script:

".session_id()." -that's our session id, hmmm");
?> // END OF A SCRIPT

The lines from #1 to #3 intentionally set these parameters to the garbage 
collector just to speed up the results of the problem.
#4 - we're sleeping 

So, after first run we have: after #5 - a new session, #7 puts a variable 
in the session and #8 tells us about that.
After #5 we also have the session file "/tmp/sess_?" written out
there anywhere.

On second run after #5 (we've been sleeping enough on #4 to have our
session announced "old", "...dead-man-walking..." - quotation from 'The
Green Mile' movie), the gc-monster is awaken and hungry for eating "old"
session files. Finally we have the session file "/tmp/sess_?" deleted 
by the garbage collector after #5.
That's guaranteed by #1 - #4.

[If we put another 'sleep' after "/* #5 */session_start()",
we may have time to switch to '/tmp' directory and persuade ourselves
that there is no session file any more after the execution of #5.]

No session file - no session variables anymore, no session at all???
WRONG ANSWER!
We are sent to the 'else' clause, so "$_SESSION['a_sess_string]" is set
and alive , and its value - additionally - is the one before the session
file has gone (deleted) - "abcd" in my example.

Obviously 'session_start()' first fills all of the sesion variables into
memory, and after that shoots the garbage collector to go to finish its
cleaning work. The session file is deleted, but inside the session, in
our script, we are not acquainted with that... Until the end of script we 
are happy that everything is all right, but probably this self-confidence 
could lead us to some troubles later.

Is there a workaround? Without going to the file system to check if the
file still exists? A smart and elegant PHP session way, without any
if-file-exists-checking functions?

P.S. (To the administrators/moderators/whatever of this mailing list) - Please 
tell the people - write it somewhere on http://www.php.net/mailing-lists.php - 
that there is no chance to get subscribed if they are using any public mail 
address like @yahoo.com. It took me 2 days, I struggled like a pig with a 
pumpkin to find out...

-
Bulgarian National Radio
IT Department
(+359 2) 9336 615
BNR - Sofia, Bulgaria

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Garbage in odbc_connect error

2005-07-20 Thread Vandana Ponnuru
Hi all,

 I have PHP-4.3.10 and Apache-2.0 running on a Redhat 9
machine. I am connecting to DB2 using the odbc API. I have different
applications running connecting to different databases and the
applications were all running perfectly fine. But now, odbc_connect
fails with some garbage in the SQL error code (error code pasted
below), when connecting to one particular database. (Connections to
other databases are still working fine). Connecting to the database
directly (without using PHP, from the DB2 command prompt) does not
give any errors, though. Since the error messages are not readable, I
am not able to go further on this. Please advice as to how I should
proceed.

Warning: odbc_connect(): SQL error: |U', SQL state ýÿÿÿA in
SQLConnect in /var/www/html/fvt/functions.php on line 87


Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Garbage

2003-03-06 Thread Bas Verhoeven
Hi,

I recently upgraded PHP to version 4.3.1, however I have some problems with
it. When I open some PHP files it shouts garbage at me + some html or just a
blank screen, when i look at the file on the server nothing has changed, I
already tried uploading the files to another location, keep getting the
same.

Someone who had the same problems and/or can help me?

Thanks in advance.

Bas Verhoeven



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage at beginning of uploaded Text File

2003-03-01 Thread Monty
> Are you using Apache2? IIRC, there was a bug where data would get added
> to the POST data, or something along those lines...
> 
> What if you just look at the file with a regular text editor? Do you see
> that data there after it's uploaded and written to the server, or does
> it just appear into the data when it's fread()?
> 
> ---John W. Holmes...
 
John, when I open the file in a text editor I don't see the garbage, just
the text. I have Apache 1.3.22 on my server. I'm not writing the contents to
a file once uploaded to the server because I want to store it in a database
field. The garbage is added to the DB just as it appears when I echo the
variable to the screen after the file has been uploaded.

Also, I'm doing the fread() on the tmp_name after the file is uploaded,
because I don't need the file once I read the contents into a variable.

I was wondering if changing the "enctype" parameter in the  tag would
make a difference (but I don't know what to change it to). Currently it's
set to "multipart/form-data".

Thanks!


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Garbage at beginning of uploaded Text File

2003-03-01 Thread John W. Holmes
> I have a form that allows someone to upload a text file, the contents
of
> which will be inserted into the database. When I fread() the file,
there
> is
> some garbage at the beginning and end of the text.
> 
> Here's what the text looks like:
> 
> This is the sentence of text.
> 
> Here's what it looks like after uploaded and fread():
> 
> *ch?¡®ºdä?º†Ím This is the sentence of text.SORT~€ÿÿ
> 
> 
> The text file being uploaded is a BBedit file, which should be a plain
> text
> file. I'm not sure where this garbage is coming, and if there's an
easy
> way
> to remove it before I put this into the Database. I searched the PHP
help
> files for an hour and searched here, and couldn't find anything
related.
> 
> I'm using PHP 4.2.3 on a Redhat Linux server.
> 
> Thanks.

Are you using Apache2? IIRC, there was a bug where data would get added
to the POST data, or something along those lines...

What if you just look at the file with a regular text editor? Do you see
that data there after it's uploaded and written to the server, or does
it just appear into the data when it's fread()?

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Garbage at beginning of uploaded Text File

2003-03-01 Thread Monty
I have a form that allows someone to upload a text file, the contents of
which will be inserted into the database. When I fread() the file, there is
some garbage at the beginning and end of the text.

Here's what the text looks like:

This is the sentence of text.

Here's what it looks like after uploaded and fread():

*ch?¡®ºdä?º†Ím This is the sentence of text.SORT~€ÿÿ


The text file being uploaded is a BBedit file, which should be a plain text
file. I'm not sure where this garbage is coming, and if there's an easy way
to remove it before I put this into the Database. I searched the PHP help
files for an hour and searched here, and couldn't find anything related.

I'm using PHP 4.2.3 on a Redhat Linux server.

Thanks.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Garbage Collection?

2002-08-21 Thread Rasmus Lerdorf

> Hi everybody,
>
> Is there any requirement to free variables in php, or is there any
> garbage collection or built-in module that terminates unused variables?
> (Especially for arrays and class instances)...

Garbage collection is automatic in PHP.  When you do:

$a = 123;
$a = 456;

Then the memory for 123 is returned to the system as soon as you re-assign
$a.  You can also return it by doing unset($a);

-Rasmus


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Garbage Collection?

2002-08-21 Thread Vehbi Sinan Tunalioglu

Hi everybody,

Is there any requirement to free variables in php, or is there any 
garbage collection or built-in module that terminates unused variables? 
(Especially for arrays and class instances)...

Have a nice day...
Vehbi Sinan Tunalioglu


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Garbage .html via HTTP/1.0 or Proxy

2002-08-12 Thread Jim Dam

Are you using gzip compression?  Maybe the browser you are using doesn't
support gzip.

- Original Message -
From: "Kelvin Lawson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 12, 2002 4:55 PM
Subject: [PHP] Garbage .html via HTTP/1.0 or Proxy


Hi All,

When connecting to my site from certain clients, the .html returned contains
a large block of non-standard characters.

Running it locally and from various other places, the site looks normal. But
when I connect from work, the .html file returned is corrupted. At work we
have a web proxy, and I also noticed from my Apache logs that HTTP/1.0 is
used for the request. Has anyone experienced problems due to those two
reasons ?

This seems weird to me because PHP is generated on my server, so I assumed
all clients would see exactly the same. But this isn't the case here. Either
the html generated is different for these clients, or the returned page is
getting corrupted somewhere along the way.

Does anyone know why this might happen ?

I'm using WinXP Apache 2.0.39 with PHP 4.2.1. There are no errors in the
Apache logs. Also the corruption doesn't happen on all pages.

Thanks for any tips,
Kelvin.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Garbage .html via HTTP/1.0 or Proxy

2002-08-12 Thread Kelvin Lawson

Hi All,

When connecting to my site from certain clients, the .html returned contains a large 
block of non-standard characters.

Running it locally and from various other places, the site looks normal. But when I 
connect from work, the .html file returned is corrupted. At work we have a web proxy, 
and I also noticed from my Apache logs that HTTP/1.0 is used for the request. Has 
anyone experienced problems due to those two reasons ?

This seems weird to me because PHP is generated on my server, so I assumed all clients 
would see exactly the same. But this isn't the case here. Either the html generated is 
different for these clients, or the returned page is getting corrupted somewhere along 
the way.

Does anyone know why this might happen ?

I'm using WinXP Apache 2.0.39 with PHP 4.2.1. There are no errors in the Apache logs. 
Also the corruption doesn't happen on all pages.

Thanks for any tips,
Kelvin.