in reply to Re^11: DBI Problem
in thread DBI Problem

Where specifically would you suggest I look?

The first query returns the desired result. So the session goes out of scope after that first query is run. Why? And how to work around that? Please show us why you feel $session has a valid value when the first call to executequery gets executed. Please explain why you feel $session goes out of scope after the first query is run. Please explain why you feel a need to flush the session buffers in executequery at all. Please explain what $session has to do with executequery at all.

I am not running anything. My hosting company is running perl. I f you are not running anything how does your website even function. You are running 5.8.8 released 2006-02-02 yet you say that is quite a while for it to go unfixed. Even though the author points out it is not a bug in his code but a fault in YOUR CODE in that you are letting the database get closed before flushing the session data, you complain that it should have been fixed by now even though your perl has not even been updated since before then.

All the other calls to executequery are not followed by a second call. This one is unique. This has nothing to do with executequery except that you wrongly try to flush the session data there. It might help if you hand inspect your code paying attention to when $session gets assigned a valid value, when it is getting used and when it goes out of scope

Replies are listed 'Best First'.
Re^13: DBI Problem
by tultalk (Monk) on Oct 01, 2017 at 00:47 UTC

    Tried $dbh->trace(2);

    Sat Sep 30 18:42:26 2017 manage_users.cgi: call after 2nd execute: 'DBI::db=HASH(0x21ec980)' dsn: 'dbi:mysql:database=jalamior_assoc_mgr;host=localhost' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 684.

    -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x1f09930)~INNER)

    <- DESTROY= undef at manage_users.cgi line 245

    -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x21ecca0)~INNER)

    --> dbd_st_finish

    >- dbd_st_free_result_sets

    <- dbd_st_free_result_sets RC -1

    <- dbd_st_free_result_sets

    <-- dbd_st_finish

    <- DESTROY= undef at manage_users.cgi line 245

    ! -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x1f09520)~INNER)

    Freeing 1 parameters, bind 0 fbind 0

    ! <- DESTROY= undef during global destruction

    >> DESTROY DBI::db=HASH(0x21ec870) clearing 1 CachedKids

    ! -> DESTROY for DBD::mysql::db (DBI::db=HASH(0x21ec870)~INNER)

    imp_dbh->pmysql: 227bfe0

    ! <- DESTROY= undef during global destruction

    Sat Sep 30 18:42:26 2017 manage_users.cgi: (in cleanup) Can't connect to data source '' because I can't work out what driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at /usr/local/lib/perl5/site_perl/5.8.8/CGI/Session/Driver/DBI.pm line 26

    DESTROY= undef at manage_users.cgi line 245

    manageusers::OpenConnection(); #This is called for update member info Line 245---> if (!UpdateUserData($sid,$password,$email,$secret)) { ## manageusers::CloseConnection(); CreateUserFeedbackForm("Update of Member informatio +n failed. Please contact the office."); return; } else { # manageusers::CloseConnection(); CreateUserFeedbackForm("Update of Member informatio +n succeeded."); #Need to email back to office. return; } return;

    So is the destroy undefined the problem to chase?

        Fixed. Thanks all.

        sub UpdateUserData { # $dbh->trace(2); my ($sid, $password,$email,$secret) = @_; $session = new CGI::Session("driver:MySQL",$sid, {Handle=>$dbh}); my $SQL = qq|SELECT id FROM $sql_session_table WHERE id = '$sid' | +; my $sth = ExecuteQuery($SQL); my ($tsid, $userid) = $sth->fetchrow_array(); if (!$tsid) { return 0; } else { my $userid = $session->param("user_id"); my $username = $session->param("username"); if (! defined $userid ){ return 0; } my $updateinfoemail = "webpass\@jala-mi.org"; my $passpart = ""; my $mailpart = ""; my $secretpart = ""; if ($password ne "") { $passpart = "password = '$password'"; } if (($email ne "") && ($password eq "")) { $mailpart = "email = '$email'"; } elsif (($email ne "") && ($password ne "")) { $mailpart = ", email = '$email'"; } if (($secret ne "") && ($password eq "") && ($email eq "")) { $secretpart = "secret = '$secret'"; } elsif (($secret ne "") && (($password ne "") || ($email ne "") +)) { $secretpart = ", secret = '$secret'"; } my $wherepart = " where user_id = '$userid'"; my $statement = "update $sql_user_table set $passpart $mailpar +t $secretpart $wherepart"; $SQL = qq| $statement |; my $sth1 = ExecuteQuery($SQL); # success so disconnect and send an e-mail with the missing/al +tered information to the user. $session->flush() or die "Unable to update session storage\n" +; my $password1 = "'06#$password&422'"; my $userid1 = "61345$userid"; my $message = "The member has updated their information throug +h the website. The member userid is :'$userid1'. Their new password i +s '$password1' "; my $subject = 'JALA Update Information Request.'; my $from = 'webmaster@jala-mi.net'; my $to = $updateinfoemail; my $body = $message; my $heading = "Member Update Information"; my $closing = "Office Manager: Please update the member databa +se."; my $signiture = "JALA Support"; my $result = SendMemberMail($subject,$from,$to,$heading,$body, +$closing,$signiture); return 1; } }

        Somehow you still think this has to do with ExecuteQuery but it does not.

        No I don't. I was just looking at the dbh dbi around the calls to execute.

Re^13: DBI Problem
by Anonymous Monk on Sep 30, 2017 at 16:41 UTC
    I am not running anything. My hosting company is running perl.
    Lol dude, I think you're getting trolled.