For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > January 2007 > Strange Database Error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Strange Database Error
Smiley

2007-01-24, 9:58 pm

Okay, I've already managed to track down this bug and fix it. But the thing
is, I'm not quite sure why it happened and it's left me scratching my head.

I was setting up some scripts to display videos embedded in a webpage. The
program does some writing to a database to store captions and such. For
some reason, though, the database writing wasn't working. I'd tested out
the functions in other scripts and they went just fine. I wasn't sure what
was going on. So I tested out the script by stopping it at certain points.
If I stopped the script right after it wrote to the database, then the
database was updated perfectly. So doing this I narrowed down the source of
my problem.

For some reason, the place at fault was much farther down in my code, and it
had nothing to do with database access whatsoever. It was a part of my
script that I set up to embed RealPlayer to play .rm or .ram clips. It came
down to this code (which is part of a larger string to embed the player):

<EMBED src='$videofile' width='$vidwidth' height='$vidheight'
loop='0' type='audio/x-pn-realaudio-plugin' controls='imagewindow'
console='video' autostart='0'>

The problem was that I put in the wrong variable instead of $videofile. So
the player didn't get the right filename and couldn't really play the video.
Once I corrected that, the database problem disappeared.

But how is this code connected to the database in any way whatsoever?? I
just don't get it!


ljb

2007-01-24, 9:58 pm

none@ofyourbusiness.com wrote:
>...
> But how is this code connected to the database in any way whatsoever?? I
> just don't get it!


Perhaps: script abort caused uncommitted database actions to be rolled back?
Depends on which database (you didn't say) and if it was auto-committing or
not, but it is possible.
Smiley

2007-01-25, 3:59 am


"ljb" <lbayuk@pobox.com.no.spam.> wrote in message
news:ORUth.18552$X72.5278@newsread3.news.pas.earthlink.net...
> none@ofyourbusiness.com wrote:
>
> Perhaps: script abort caused uncommitted database actions to be rolled
> back?
> Depends on which database (you didn't say) and if it was auto-committing
> or
> not, but it is possible.
>


It's a MySQL database. The rest of the page seemed to load up fine, even if
the realplayer embed didn't quite work properly.

When does a database action become committed?


ljb

2007-01-25, 9:59 pm

none@ofyourbusiness.com wrote:
>
> "ljb" <lbayuk@pobox.com.no.spam.> wrote in message
> news:ORUth.18552$X72.5278@newsread3.news.pas.earthlink.net...
>
> It's a MySQL database. The rest of the page seemed to load up fine, even if
> the realplayer embed didn't quite work properly.
>
> When does a database action become committed?


If a database is doing "auto-commit", then each SQL statement is committed
as soon as it completes. If not in auto-commit mode, it takes an explicit
SQL "COMMIT" to actually apply the changes. With some databases, if the
connection is closed inside a transaction without a COMMIT, it acts like
you did ROLLBACK and undoes the changes. But it doesn't sound like this
will help. Also I don't know much about MySQL specifically.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com