in reply to Re: STRICT question
in thread STRICT question

I have in my script variables with my $variableA and the use vars qw(............)
, and when i put my variables in use vars qw(....) on 7 variables add , my script don't want to execute.
Don't out none warnings. :(
Update:
This is my script:
#!perl -w use CGI::Carp('fatalsToBrowser'); use CGI qw/:standard/; use strict; use DBI; use vars qw($query $dbase $userdb $passworddb $cgi_url $idProdus); $query = CGI->new(); $cgi_url = "http://localhost/cgi-bin/script.pl"; $dbase= "test"; $userdb = "admin"; $password = "123456"; my $count=0; my $driver = "dbi:mysql:" . $dbase; my $dbh = DBI->connect($driver, $userdb, $passworddb) or die "Error $D +BI::errstr\n"; my $statement = $dbh->prepare("SELECT id_produs, denumire FROM produse +") or die "Error $DBI::errstr\n"; $statement->execute or die "Error $DBI::errstr\n"; print $query->header(-type=>'text/html'); print <<ENDHTML; Pentru a vedea ce aveti in cos dati click <a href="$cgi_url/shop.pl?pr +oduct=viewCart">aici!</a> <br>Pentru check out dati click <a href="$cgi_url/shop.pl?product=chec +kOut">aici!</a><br><form action="$cgi_url/shop.pl" method="get"> <input type="hidden" name="product" value="viewProduct"><select name=" +id"><option value="none">Select product</option> ENDHTML while (($idProdus, $denumireProdus) = $statement->fetchrow_array) { print <<ENDHTML; <option value="$idProdus">$denumireProdus</option> ENDHTML my $count++; } print <<ENDHTML; </select><input type="submit" value="View Product"></form> ENDHTML $statement->finish; $dbh->disconnect; $dbh = DBI->connect($driver, $userdb, $passworddb) or die "Error $DBI: +:errstr\n"; $statement = $dbh->prepare("SELECT denumire, pret, url_demo, descriere +, url_download, foto FROM produse WHERE id_produs = $count") or die +"Error $DBI::errstr\n"; $statement->execute or die "Error $DBI::errstr\n"; ($denumire, $pret, $url_demo, $descriere, $url_download, $foto) = $sta +tement->fetchrow_array(); print <<ENDHTML; <br><br><table border=0> <form action="$cgi_url/shop.pl" method="get"> <input type=hidden name="product" value="add"> <input type=hidden name="canditate" value="1"> <input type=hidden name="idp" value="$count"> <input type=hidden name="title" value="$denumireProd"> <input type=hidden name="descriere" value="$descriere"> <input type=hidden name="price" value="$pret"> <input type=hidden name="fotoProdus" value="$foto"> <tr><td rowspan=3> <img src="$foto"> </td><td> <b>$denumireProd</b></td></tr> <tr><td> $descriere</td></tr> <tr><td align=right> <a href="$url_demo">Try demo!</a> Pret: $pret <input type=submit val +ue="Buy now!"> </td></tr></form></table><hr> ENDHTML $statement->finish; $dbh->disconnect; $newCount = $count - 1; $dbh = DBI->connect($driver, $userdb, $passworddb) or die "Error $DBI: +:errstr\n"; $statement = $dbh->prepare("SELECT denumire, pret, url_demo, descriere +, url_download, foto FROM produse WHERE id_produs = $newCount") or d +ie "Error $DBI::errstr\n"; $statement->execute or die "Error $DBI::errstr\n"; ($denumire, $pret, $url_demo, $descriere, $url_download, $foto) = $sta +tement->fetchrow_array(); print <<ENDHTML; <br><br><table border=0> <form action="$cgi_url/shop.pl" method="get"> <input type=hidden name="product" value="add"> <input type=hidden name="canditate" value="1"> <input type=hidden name="idp" value="$newCount"> <input type=hidden name="title" value="$denumire"> <input type=hidden name="descriere" value="$descriere"> <input type=hidden name="price" value="$pret"> <input type=hidden name="fotoProdus" value="$foto"> <tr><td rowspan=3> <img src="$foto"> </td><td> <b>$denumire</b></td></tr> <tr><td> $descriere</td></tr> <tr><td align=right> <a href="$url_demo">Try demo!</a> Pret: $pret <input type=submit val +ue="Buy now!"> </td></tr></form></table> ENDHTML print <<ENDHTML; <br><br>Total produse gasite: $count<br> ENDHTML exit; $statement->finish; $dbh->disconnect; print <<ENDHTML; Nu exista in baza de date <b>$dbase</b> nici un produs. ENDHTML exit;


This is all my script.

Replies are listed 'Best First'.
Re: Re: Re: STRICT question
by ChrisR (Hermit) on Oct 23, 2003 at 12:52 UTC
    This line $password = "123456"; should be my $password = "123456"; or perhaps you meant to use $passworddb there. Since you don't tell us anything about the error you are getting, this is just a guess.
      I dont have some error message. The script don't work. Don't execute. My browser is blank(none).
        It's hard to believe that that are no errors and that your browser window is just blank. I suppose this coul dhappen if your web server was misconfigured but here's another shot at an answer. I noticed the first line in your script
        #!perl -w
        This line is the path to perl on your system. My guess is that perl is located in /usr/bin/ or /usr/local/bin or something like that. You need to be sure that you know where perl is and fix that line to show the actual path. Then use warnings; You also need to loacte your webserver's error log and watch the messages that are being written to that file. If you are still having trouble after that, let us know and we'll try again.

        What webserver are you using? What does the error log say?

        -- vek --