[Wolves] Any PHP/MySQL experts who can help me?
David Craddock
david.paul.craddock at googlemail.com
Tue May 8 23:56:09 BST 2007
Do this:
$result = mysql_query(" UPDATE userAccount SET loggedOn = 'N' WHERE userID =
'$userID' ") or die(mysql_error());
This will promptly alert you if you have any database problems.
I always do this by habit, as I'm always getting database errors.
On 5/8/07, Philip Harper <ph004h7245 at blueyonder.co.uk> wrote:
>
> Hi,
>
> Thanks for all the suggestions....but I've tried most of them before!
>
> The dbcon.php file simply contains the standard PHP code I use to create
> a connection to the MySQL database.
>
> I think it is just a case of something working slightly different on the
> sourceforge server, as any PHP developer knows, PHP has so many
> different options and compilation options it is sometimes tricky to find
> which one is causing the problem on a different server that you are
> installing your system on, and it's often a case of just trying to make
> your scripts as portable as possible. Maybe I'll raise a support request.
>
> James Dalley wrote:
> > > Date: Thu, 3 May 2007 16:42:49 +0100
> > > From: ph004h7245 at blueyonder.co.uk
> > > To: wolves at mailman.lug.org.uk
> > > Subject: [Wolves] Any PHP/MySQL experts who can help me?
> > >
> > > Hi
> > >
> > > I have an interesting problem, well, I guess not interesting as much
> as
> > > annoying the hell out of me at the moment!
> > >
> > > I have a script that logs a user out of my system:-
> > >
> > > <?php
> > >
> > >
> > >
> > > session_start();
> > >
> > > include 'dbcon.php';
> > >
> > >
> > > /* Change database entry to say that the user is no longer logged in
> */
> > >
> > > $userID = $_SESSION['user'];
> > >
> > > $result = mysql_query(" UPDATE userAccount SET loggedOn = 'N' WHERE
> > > userID = '$userID' ");
> > >
> > >
> > > /* destroy session */
> > > session_destroy();
> > >
> > > mysql_close( $link );
> > >
> > > header("Location: logout.html");
> > >
> > > ?>
> > >
> > > Now, on my server this works fine, I check the userAccount database
> > > table, and the loggedOn field is correctly set to "N" as it should
> > be to
> > > say the user has logged off, but for some reason, the test system I'm
> > > running on sourceforge dosen't do this, the user logs of, but there
> > > entry is still loggedOn = "Y".
> > >
> > > On my own server where the script works I'm running Ubuntu Dapper 6.06
> > > LTS installed with the LAMP option, so it auto installs PHP5 and
> MYSQL5.
> > >
> > > The even stranger thing is that the login script, which uses the exact
> > > same PHP/MySQL code as above, but in that case to set loggedOn = "Y"
> > > works perfectly on both my server and sourceforge!
> > >
> > > I'm stumped, give me more coffee......
> > >
> >
> >
> > PS Silly Question but, Have you tried mysql_close then destoy??
> >
> > ------------------------------------------------------------------------
> > Be one of the first to try Windows Live Mail. Windows Live Mail.
> > <
> http://ideas.live.co.uk/ProgramPage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d&pageId=0
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Wolves LUG mailing list
> > Homepage: http://www.wolveslug.org.uk/
> > Mailing list: Wolves at mailman.lug.org.uk
> > Mailing list home: https://mailman.lug.org.uk/mailman/listinfo/wolves
>
>
>
> _______________________________________________
> Wolves LUG mailing list
> Homepage: http://www.wolveslug.org.uk/
> Mailing list: Wolves at mailman.lug.org.uk
> Mailing list home: https://mailman.lug.org.uk/mailman/listinfo/wolves
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/wolves/attachments/20070508/5d285cef/attachment.html
More information about the Wolves
mailing list