Ged Haywood writes: > Hi there, > > On Fri, 1 Mar 2002, Axel Andersson wrote: > >> I run a mod_perl/mysql site, which works fine most of the time. Some >> pages, however, come out completely blank. Reload.. and hey presto, > [snip] >> Well, it's a longshot, but thanks anyway. > > Another long shot, do you always specify full paths to files in your code?
> > If you don't get anywhere with that then I'd suggest looking at the debugging > section of the Guide: http://prel.apache.org/guide and/or peppering your code > at strategic places with 'print STDERR "$something_useful\n"' statements. > > 73, > Ged. > I have been getting the same problems with the same setup ( Mod_Perl / MySQL). But I am having a little fun with this setup. I populated a small table in the 'test' DB in MySQL withe the contents of '/usr/local/share/dict/propernames'. I then have the script to randomly chose an id from the DB table and then to select a row of info. I will post the scipt contents and some debugging data to give some more info on the internal processes. The Script is : 1 package DBNE; 2 3 use strict; 4 use vars qw($DBH); 5 use Apache; 6 #use Apache::File; 7 use DBI(); 8 9 sub handler { 10 $DBH = DBI->connect("DBI:mysql:test","webuser","mult1scan") || die $DBH->errstr; 11 my $r = shift; 12 my $h = $DBH->trace(5,"/tmp/DBI.log"); 13 14 $r->send_http_header; 15 my $sth = $DBH->prepare("SELECT MAX(id) FROM webtest"); 16 $sth->execute; 17 my ($id) = $sth->fetchrow; 18 19 my $sth = $DBH->prepare("SELECT * FROM webtest WHERE id = ROUND( (RAND() * $id) + 1)"); 20 $sth->execute; 21 22 my ($id,$name,$last,$town) = $sth->fetchrow; 23 $r->print("$id\t\t $name\t\t $last\t\t $town \n"); 24 $sth->finish; 25 26 } 27 28 1; The debuging info is: <- DESTROY= undef at /home/mcalvo/ModPerl/DBNE.pm line 11 DBI::db=HASH(0x81faf3c) trace level set to 5 in DBI 1.20-nothread Note: perl is running without the recommended perl -w option -> prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT MAX(id) FROM webtest') dbih_setup_handle(DBI::st=HASH(0x8156390)=>DBI::st=HASH(0x81e90d8), DBD::mysql::st, 81faef4, Null!) dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Err, DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc78) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), State, DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Errstr, DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Handlers, DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Debug, DBI::db=HASH(0x81faf3c)) 5 (already defined) dbih_setup_attrib(DBI::st=HASH(0x81e90d8), FetchHashKeyName, DBI::db=HASH(0x81faf3c)) 'NAME' (already defined) Setting mysql_use_result to 0 <- prepare= DBI::st=HASH(0x8156390) at /home/mcalvo/ModPerl/DBNE.pm line 15 -> execute for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8) -> dbd_st_execute for 081fac90 <- dbd_st_execute 1 rows <- execute= 1 at /home/mcalvo/ModPerl/DBNE.pm line 16 -> fetchrow for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8) -> dbd_st_fetch for 081fac90, chopblanks 0 dbih_setup_fbav for 1 fields => 0x8135854 Storing row 0 (1323) in 081fae64 <- dbd_st_fetch, 1 cols <- fetchrow= ( '1323' ) [1 items] row1 at /home/mcalvo/ModPerl/DBNE.pm line 17 -> prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT * FROM webtest WHERE id = ROUND( (RAND() * 1323) + 1)') dbih_setup_handle(DBI::st=HASH(0x81faf90)=>DBI::st=HASH(0x81faf24), DBD::mysql::st, 81faf78, Null!) dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204) dbih_setup_attrib(DBI::st=HASH(0x81faf24), Err, DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc78) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81faf24), State, DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81faf24), Errstr, DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81faf24), Handlers, DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined) dbih_setup_attrib(DBI::st=HASH(0x81faf24), Debug, DBI::db=HASH(0x81faf3c)) 5 (already defined) dbih_setup_attrib(DBI::st=HASH(0x81faf24), FetchHashKeyName, DBI::db=HASH(0x81faf3c)) 'NAME' (already defined) Setting mysql_use_result to 0 <- prepare= DBI::st=HASH(0x81faf90) at /home/mcalvo/ModPerl/DBNE.pm line 19 -> execute for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24) -> dbd_st_execute for 081e9084 <- dbd_st_execute 0 rows <- execute= '0E0' at /home/mcalvo/ModPerl/DBNE.pm line 20 -> fetchrow for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24) -> dbd_st_fetch for 081e9084, chopblanks 0 <- fetchrow= ( ) [0 items] row-1 at /home/mcalvo/ModPerl/DBNE.pm line 22 -> finish for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24) <- finish= 1 at /home/mcalvo/ModPerl/DBNE.pm line 24 -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x81e90d8)~INNER) <- DESTROY= undef -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x81faf24)~INNER) <- DESTROY= undef It seems that the query is returning 0 as a value but why?? Can any onw please help me. Thank you -Max