473,387 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

CGI to MYSQL on IIS6 not working

dbrewerton
115 100+
Hello all. This script I have did work on linux/apache and my service provider has told me the cgi-handler has been properly set up. I am able to get hello world test to display to a web page. My problem comes in when I try to connect to a mysql DB on IIS 6. My script reads as follows:

Expand|Select|Wrap|Line Numbers
  1. use DBI qw(:sql_types);
  2.  
  3. $title = 'EnergyWise Device Test - Reading List';
  4. $start = 40;
  5.  
  6. print <<ENDSTART;
  7. Content-Type: text/html; charset=iso-8859-1
  8.  
  9. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  10. <html lang="en-US">
  11. <head>
  12. <title>$title</title>
  13. </head>
  14. <body>
  15. <h1 style="font-size:1.2em">$title</h1>
  16. ENDSTART
  17.  
  18. $dbName = "DBI:mysql:database";
  19. $dbUser = "myuserid";
  20. $dbPass = "mypass";
  21. $numrows = 5;
  22. $dbh = DBI->connect($dbName, $dbUser, $dbPass) || die "Die: $DBI::errstr\n";
  23.  
  24.     $sql = "select max(raw_id) from data";
  25.     $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  26.     $result = $sth->execute() || print "execute: $sql: $DBI::errstr";
  27.     @record = $sth->fetchrow();
  28.     $maxid = @record[0];
  29.     $sth->finish();
  30.     print $maxid," rows found.  Last ", $numrows, " shown below:";
  31.     $minid = $maxid-$numrows;
  32.     $sql = "select * from data where raw_id > \"$minid\"";
  33.     $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  34.     $result = $sth->execute() || print "execute: $sql: $DBI::errstr";
  35.     while (@results = $sth->fetchrow() ) {
  36.         print "<p>Row ";
  37.         print @results[0];
  38.         print ":<p>";
  39.         print show(@results[1]);
  40.         }
  41.     $sth->finish();
  42.     $dbh->disconnect();
  43. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
  44. $now = sprintf "%4d-%02d-%02dT%02d:%02dZ", 1900+$year,$mon+1,$mday,$hour,$min;
  45. print p('Processed '.$now."\n");
  46. print end_html;
  47.  
  48. sub show {
  49.     $_[0] = escapeHTML($_[0]);
  50.     $_[0] =~ s/\r\n/<br>/g;
  51.     $_[0] =~ s/\n/<br>/g;
  52.     return $_[0]; }
Logically to me the script should function. What I get in return from the web page is:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
Dec 10 '09 #1

✓ answered by RonB

Here's an adjusted version, which still has room for improvment.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use CGI qw(:standard);
  6. use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
  7. use DBI qw(:sql_types);
  8.  
  9. print header();
  10. warningsToBrowser(1);
  11.  
  12. my $dbName = "egwtest";
  13. my $dbHost = "10.30.125.80";
  14. my $dbUser = "************";
  15. my $dbPass = "************";
  16.  
  17. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass,
  18.                        { RaiseError => 1 })
  19.                or die "Die: $DBI::errstr\n";
  20.  
  21. # Prepare the SQL statement
  22. my $sth= $dbh->prepare("SELECT VERSION()") or die $DBI::errstr;
  23. # Send the statement to the server
  24. $sth->execute();
  25.  
  26. my $numRows = $sth->rows; # This is not always accurate.
  27. print "Rows returned: $numRows\n";
  28.  
  29. while ( my @row = $sth->fetchrow_array )
  30. {
  31.     print "@row\n";
  32. }
  33.  
  34. $dbh->disconnect(); 

17 3485
RonB
589 Expert Mod 512MB
Add this line just above the use DBI statement.
Expand|Select|Wrap|Line Numbers
  1. use CGI::Carp qw(fatalsToBrowser);
Then test the script and post back with the exact error message.
Dec 10 '09 #2
dbrewerton
115 100+
Expand|Select|Wrap|Line Numbers
  1. syntax error at \cgi-bin\newtest.cgi line 13, near "$dbHost "
  2. syntax error at \cgi-bin\newtest.cgi line 18, near "DBI:"
  3. Execution of \cgi-bin\newtest.cgi aborted due to compilation errors.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

I dumbed down the script to only use a small section of code. The code I'm using reads:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use CGI qw(:standard);
  3. use CGI::Carp qw(fatalsToBrowser);
  4. use DBI qw(:sql_types);
  5.  
  6. print <<ENDSTART;
  7. Content-Type: text/html
  8.  
  9. <html>
  10. ENDSTART
  11.  
  12. $dbName = "egwtest"
  13. $dbHost = "10.30.125.80";
  14. $dbUser = "************";
  15. $dbPass = "************";
  16. $numrows = 5;
  17.  
  18. $dbh = DBI->connect(DBI:mysql:database=$dbName:host=$dbHost,$dbUser,$dbPass) || die "Die: $DBI::errstr\n";
  19.  
  20. # Prepare the SQL statement
  21. my $sth= $dbh->prepare("SELECT VERSION()") or die $DBI::errstr;
  22. # Send the statement to the server
  23. $sth->execute();
  24. my $numRows = $sth->rows;
  25. print "Rows returned: $numRows\n";
  26. my @row;
  27. while ( @row = $sth->fetchrow_array )
  28. {
  29. print "@row\n";
  30. }
  31.  
  32. $dbh->disconnect();
Dec 10 '09 #3
dbrewerton
115 100+
I think it is the syntax of my connection string.

$dbh = DBI->connect(DBI:mysql:database="egwtest":host="10.30. 125.80",$dbUser,$dbPass) || die "Die: $DBI::errstr\n";
Dec 10 '09 #4
RonB
589 Expert Mod 512MB
That version also has compilation errors.

C:\TEMP>perl -c dbrewerton.pl
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: Scalar found where operator expected at dbrewerton.pl line 13, near "$dbHost"
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: (Missing semicolon on previous line?)
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: Unquoted string "mysql" may clash with future reserved word at dbrewerton.pl line 18.
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: Unquoted string "database" may clash with future reserved word at dbrewerton.pl line 18.

[Thu Dec 10 08:26:01 2009] dbrewerton.pl: Unquoted string "host" may clash with future reserved word at dbrewerton.pl line 18.
Status: 500
Content-type: text/html

<h1>Software error:</h1>
<pre>syntax error at dbrewerton.pl line 13, near &quot;$dbHost &quot;
syntax error at dbrewerton.pl line 18, near &quot;DBI:&quot;
dbrewerton.pl had compilation errors.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.

</p>
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: syntax error at dbrewerton.pl line 13, near "$dbHost "
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: syntax error at dbrewerton.pl line 18, near "DBI:"
[Thu Dec 10 08:26:01 2009] dbrewerton.pl: dbrewerton.pl had compilation errors.
Take out the -w switch and add these to lins (pragmas).
Expand|Select|Wrap|Line Numbers
  1. use strict;
  2. use warnings;
Those pragmas should be in every Perl script you write. They will help point out lots of mistakes/errors that can be difficult to track down otherwise.
Dec 10 '09 #5
RonB
589 Expert Mod 512MB
Here's an adjusted version, which still has room for improvment.
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. use warnings;
  5. use CGI qw(:standard);
  6. use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
  7. use DBI qw(:sql_types);
  8.  
  9. print header();
  10. warningsToBrowser(1);
  11.  
  12. my $dbName = "egwtest";
  13. my $dbHost = "10.30.125.80";
  14. my $dbUser = "************";
  15. my $dbPass = "************";
  16.  
  17. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass,
  18.                        { RaiseError => 1 })
  19.                or die "Die: $DBI::errstr\n";
  20.  
  21. # Prepare the SQL statement
  22. my $sth= $dbh->prepare("SELECT VERSION()") or die $DBI::errstr;
  23. # Send the statement to the server
  24. $sth->execute();
  25.  
  26. my $numRows = $sth->rows; # This is not always accurate.
  27. print "Rows returned: $numRows\n";
  28.  
  29. while ( my @row = $sth->fetchrow_array )
  30. {
  31.     print "@row\n";
  32. }
  33.  
  34. $dbh->disconnect(); 
Dec 10 '09 #6
dbrewerton
115 100+
Ok, now I tried using what you show above and bringing it into my existing list.cgi script but I got tons of errors about Global symbol "$title" requires explicit package name. Do my variables need to be preceeded by my to make this work? Here is the script I'm trying to use:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2. use strict; 
  3. use warnings; 
  4. use CGI qw(:standard); 
  5. use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
  6. use DBI qw(:sql_types); 
  7.  
  8. $title = Reading List';
  9. $start = 40;
  10.  
  11. print <<ENDSTART;
  12. Content-Type: text/html; charset=iso-8859-1
  13.  
  14. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  15. <html lang="en-US">
  16. <head>
  17. <title>$title</title>
  18. </head>
  19. <body>
  20. <h1 style="font-size:1.2em">$title</h1>
  21. ENDSTART
  22.  
  23. my $dbName = "egwtest"; 
  24. my $dbHost = "10.30.125.80"; 
  25. my $dbUser = "**********"; 
  26. my $dbPass = "********"; 
  27. my $numrows = 5;
  28. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n"; 
  29.  
  30.     $sql = "select max(raw_id) from ewise_raw_data_in";
  31.     $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  32.     $result = $sth->execute() || print "execute: $sql: $DBI::errstr";
  33.     @record = $sth->fetchrow();
  34.     $maxid = @record[0];
  35.     $sth->finish();
  36.     print $maxid," rows found.  Last ", $numrows, " shown below:";
  37.     $minid = $maxid-$numrows;
  38.     $sql = "select * from ewise_raw_data_in where raw_id > \"$minid\"";
  39.     $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  40.     $result = $sth->execute() || print "execute: $sql: $DBI::errstr";
  41.     while (@results = $sth->fetchrow() ) {
  42.         print "<p>Row ";
  43.         print @results[0];
  44.         print ":<p>";
  45.         print show(@results[1]);
  46.         }
  47.     $sth->finish();
  48.     $dbh->disconnect();
  49. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
  50. $now = sprintf "%4d-%02d-%02dT%02d:%02dZ", 1900+$year,$mon+1,$mday,$hour,$min;
  51. print p('Processed '.$now."\n");
  52. print end_html;
  53.  
  54. sub show {
  55.     $_[0] = escapeHTML($_[0]);
  56.     $_[0] =~ s/\r\n/<br>/g;
  57.     $_[0] =~ s/\n/<br>/g;
  58.     return $_[0]; }
Dec 10 '09 #7
RonB
589 Expert Mod 512MB
Yes, you need to declare your vars with the my keyword just like you did for the db vars.

Also, when posting code, please use the code tags, like I did. It will retain the code indentation and makes it easier for us to help you. If you don't know where the code tag button is located, click on the "Go Advanced" button.
Dec 10 '09 #8
dbrewerton
115 100+
That one is fixed, now the other one I'm having a heck of a time with is this one called reading.cgi which allows me to import data using CGI into the MySQL DB. I don't have any undeclared vars but it is giving me that misbehaved error. Take a look please...thank you for all your help thus far :)

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2. use strict; 
  3. use warnings; 
  4. use CGI qw(:standard); 
  5. use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
  6. use DBI qw(:sql_types); 
  7.  
  8. my $dbName = "egwtest"; 
  9. my $dbHost = "10.30.125.80"; 
  10. my $dbUser = "************"; 
  11. my $dbPass = "***********"; 
  12. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n";
  13. my @fields = param();
  14. my @values = param(my $variable);
  15. my @filehandles = upload(my $variable);
  16.  
  17.  
  18. if(param()) {
  19.   for $variable(@fields) {
  20.     for my $value(@values) {
  21.       if(@filehandles) {
  22.         }
  23.       else {
  24.         $value =~ s/ / /g;
  25.     if($value eq '') {
  26.       }
  27.     else {
  28.       my $sql = "INSERT INTO data (raw_id, raw_data_xml) VALUES (default,\"$value\")";
  29.       my $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  30.       $sth->execute() || print "execute: $sql: $DBI::errstr";
  31.       $sth->fetchrow();
  32.       $sth->finish();
  33.       $dbh->disconnect();
  34.       print "12.3";    # content
  35.       }
  36.     }
  37.       }
  38.     }
  39.   }
  40. else {
  41.   print "empty";
  42.   }
  43. print "</html>";
  44.  
  45. sub show {
  46.     $_[0] = escapeHTML($_[0]);
  47.     $_[0] =~ s/\r\n/<br>/g;
  48.     $_[0] =~ s/\n/<br>/g;
  49.     return $_[0]; }
It returns this:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

If nothing is being sent, it should just say empty.
Dec 10 '09 #9
RonB
589 Expert Mod 512MB
You didn't print the html header.
Dec 10 '09 #10
dbrewerton
115 100+
I tried it with header printing but no luck... It returns the following error:

Expand|Select|Wrap|Line Numbers
  1. Software error:
  2. Can't find string terminator "ENDSTART" anywhere before EOF at \cgi-bin\reading.cgi line 11.
  3.  

Here's what I have now:

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2. use strict; 
  3. use warnings; 
  4. use CGI qw(:standard); 
  5. use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
  6. use DBI qw(:sql_types); 
  7.  
  8. my $title = Reading List'; 
  9. my $start = 40; 
  10.  
  11. print <<ENDSTART; 
  12. Content-Type: text/html; charset=iso-8859-1 
  13.  
  14. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
  15. <html lang="en-US"> 
  16. <head> 
  17. <title>$title</title> 
  18. </head> 
  19. <body> 
  20. <h1 style="font-size:1.2em">$title</h1> 
  21. ENDSTART 
  22.  
  23.  
  24. my $dbName = "egwtest"; 
  25. my $dbHost = "10.30.125.80"; 
  26. my $dbUser = "**********"; 
  27. my $dbPass = "**********"; 
  28. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n";
  29. my @fields = param();
  30. my @values = param(my $variable);
  31. my @filehandles = upload(my $variable);
  32.  
  33.  
  34. if(param()) {
  35.   for $variable(@fields) {
  36.     for my $value(@values) {
  37.       if(@filehandles) {
  38.         }
  39.       else {
  40.         $value =~ s/ / /g;
  41.     if($value eq '') {
  42.       }
  43.     else {
  44.       my $sql = "INSERT INTO ewise_raw_data_in (raw_id, raw_data_xml) VALUES (default,\"$value\")";
  45.       my $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  46.       $sth->execute() || print "execute: $sql: $DBI::errstr";
  47.       $sth->fetchrow();
  48.       $sth->finish();
  49.       $dbh->disconnect();
  50.       print "12.3";    # content
  51.       }
  52.     }
  53.       }
  54.     }
  55.   }
  56. else {
  57.   print "empty";
  58.   }
  59. print "</html>";
  60.  
  61. sub show {
  62.     $_[0] = escapeHTML($_[0]);
  63.     $_[0] =~ s/\r\n/<br>/g;
  64.     $_[0] =~ s/\n/<br>/g;
  65.     return $_[0]; }
  66.  
Dec 10 '09 #11
RonB
589 Expert Mod 512MB
Your first problem is with this line; it's missing the opening quote
Expand|Select|Wrap|Line Numbers
  1. my $title = Reading List'; 
Your next problem is with the here document that prints the header. We could fix it, but since it's a bad way of doing that, I won't. You're already loading the CGI module, so use it.

I've fixed those 2 issues, but there are others that you'll need to look at.

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl 
  2. use strict; 
  3. use warnings; 
  4. use CGI qw(:standard); 
  5. use CGI::Carp qw(fatalsToBrowser warningsToBrowser); 
  6. use DBI qw(:sql_types); 
  7.  
  8. my $title = 'Reading List'; 
  9. my $start = 40; 
  10.  
  11. print header(), start_html($title),
  12.       h1({-style=>"font-size:1.2em"}, $title);
  13.  
  14.  
  15. my $dbName = "egwtest"; 
  16. my $dbHost = "10.30.125.80"; 
  17. my $dbUser = "**********"; 
  18. my $dbPass = "**********"; 
  19. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n";
  20. my @fields = param();
  21. my @values = param(my $variable);
  22. my @filehandles = upload(my $variable);
  23.  
  24.  
  25. if(param()) {
  26.   for $variable(@fields) {
  27.     for my $value(@values) {
  28.       if(@filehandles) {
  29.         }
  30.       else {
  31.         $value =~ s/ / /g;
  32.     if($value eq '') {
  33.       }
  34.     else {
  35.       my $sql = "INSERT INTO ewise_raw_data_in (raw_id, raw_data_xml) VALUES (default,\"$value\")";
  36.       my $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr";
  37.       $sth->execute() || print "execute: $sql: $DBI::errstr";
  38.       $sth->fetchrow();
  39.       $sth->finish();
  40.       $dbh->disconnect();
  41.       print "12.3";    # content
  42.       }
  43.     }
  44.       }
  45.     }
  46.   }
  47. else {
  48.   print "empty";
  49.   }
  50. print "</html>";
  51.  
  52. sub show {
  53.     $_[0] = escapeHTML($_[0]);
  54.     $_[0] =~ s/\r\n/<br>/g;
  55.     $_[0] =~ s/\n/<br>/g;
  56.     return $_[0]; }
  57.  
Dec 10 '09 #12
dbrewerton
115 100+
Ok, I just tried the script. Apparently, it isn't making any posts into the DB as I'm using my test app to ensure records are being written. I'll continue to work with this but I do appreciate all the help you've been giving me thus far.
Dec 11 '09 #13
dbrewerton
115 100+
To manually test this, am I using the right syntax for the variable?

/cgi-bin/reading.cgi?value="<energywise><device>71827008778 4420</device><slice><time>20000103165315</time><t1>57.537</t1><t2>63.275</t2><c1>0</c1></slice></energywise>"
Dec 11 '09 #14
RonB
589 Expert Mod 512MB
Have you checked to see if your script is seeing the input data the way you think it should?

Add this just after printing the header.
Expand|Select|Wrap|Line Numbers
  1. my $value = param('value');
  2. print "'value' param = $value";

Why are you declaring $variable inside the param() and upload() calls?

That var should be declared and assigned prior to using it in those cgi function calls.
Dec 11 '09 #15
dbrewerton
115 100+
Ok, that makes sense...I'll refine the script.

What I got back from the input was this:
Expand|Select|Wrap|Line Numbers
  1. 'value' param = '7182700877844202000010316531557.53763.2750'
What I expected to see was XML formatted data like what is going into it. Like this:

Expand|Select|Wrap|Line Numbers
  1. <energywise><device>71827008778 4420</device><slice><time>20000103165315</time><t1>57.537</t1><t2>63.275</t2><c1>0</c1></slice></energywise>
Dec 11 '09 #16
dbrewerton
115 100+
I'm totally frustrated! I don't know why the script won't post to the database...Also, why is 'value' being formatted as a number instead of a string. Any help here would be most appreciated. I'll post my script again for help...

Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl  
  2. use strict;  
  3. use warnings;  
  4. use CGI qw(:standard);  
  5. use CGI::Carp qw(fatalsToBrowser warningsToBrowser);  
  6. use DBI qw(:sql_types);  
  7.  
  8. my $title = 'Reading List';  
  9. my $start = 40;  
  10.  
  11. print header(), start_html($title), 
  12. h1({-style=>"font-size:1.2em"}, $title); 
  13. my $value = param("value");
  14. print "'value' param = $value";  
  15.  
  16. my $dbName = "MyDatabase";  
  17. my $dbHost = "192.168.1.160";  
  18. my $dbUser = "MyUser";  
  19. my $dbPass = "MyPass";  
  20. my $dbh = DBI->connect("DBI:mysql:$dbName:$dbHost", $dbUser, $dbPass, { RaiseError => 1 }) or die "Die: $DBI::errstr\n"; 
  21. my @fields = param(); 
  22. my @values = param(my $variable); 
  23. my @filehandles = upload(my $variable); 
  24.  
  25.  
  26. if(param()) { 
  27.   for $variable(@fields) { 
  28.     for my $value(@values) { 
  29.       if(@filehandles) { 
  30.         } 
  31.       else { 
  32.         $value =~ s/ / /g; 
  33.     if($value eq '') { 
  34.       } 
  35.     else { 
  36.       my $sql = "INSERT INTO ewise_raw_data_in (raw_id, raw_data_xml) VALUES (default,\"$value\")"; 
  37.       my $sth = $dbh->prepare($sql) || die "prepare: $sql: $DBI::errstr"; 
  38.       $sth->execute() || print "execute: $sql: $DBI::errstr"; 
  39.       $sth->fetchrow(); 
  40.       $sth->finish(); 
  41.       $dbh->disconnect(); 
  42.       print "12.3";    # content 
  43.       } 
  44.     } 
  45.       } 
  46.     } 
  47.   } 
  48. else { 
  49.   print "empty"; 
  50.   } 
  51. print "</html>"; 
  52.  
  53. sub show { 
  54.     $_[0] = escapeHTML($_[0]); 
  55.     $_[0] =~ s/\r\n/<br>/g; 
  56.     $_[0] =~ s/\n/<br>/g; 
  57.     return $_[0]; } 
  58.  
  59.  
Dec 16 '09 #17
RonB
589 Expert Mod 512MB
Please use proper indentation on your code blocks. It will make it much easier for you and use.

Read: perldoc perlstyle
http://perldoc.perl.org/perlstyle.html

Part of your problem is with these 2 lines.
Expand|Select|Wrap|Line Numbers
  1. my @values = param(my $variable); 
  2. my @filehandles = upload(my $variable); 
You need to read the CGI documentation for the param() and upload() functions. Apparently you don't fully understand how to use them.
http://search.cpan.org/~lds/CGI.pm-3.48/lib/CGI.pm

Why do you have these 2 if blocks that do absolutely nothing?
Expand|Select|Wrap|Line Numbers
  1. if(@filehandles) { 
  2. }
  3. # and this one
  4. if($value eq '') { 
  5. }
And why this regex?
Expand|Select|Wrap|Line Numbers
  1. $value =~ s/ / /g;
It substitutes a 'space' with a 'space'.
Dec 16 '09 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: bradendh | last post by:
Hi All, Hopefully someone can help me out.. Here's my setup: PHP5, mySQL, IIS6, Win2003 I have no problems serving up PHP scripts, and I can access the DB. The problem I have is this. On...
0
by: Bill J. Vallance | last post by:
------=_NextPart_000_0057_01C35233.C0403930 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hello, I have been using Snitz forums on windows 2000 IIS5 and MySQL...
9
by: Sheldon | last post by:
Hi, I have a mysql setting problem that is driving me mad. Hopefully someone can give some advice: On the local network I have windows 2000/iis5 machine running our intranet site, with php...
1
by: Naga Kiran | last post by:
Hi I have a small query in ASP.Net on windows2003 server platform.. I built an Application in ASP.Net.... This application is hosted on the system where that system has Windows2003 Operating...
0
by: olafmol | last post by:
Hello, on our new server we're running mySQL 5 instead of mySQL 3.23 on our old server. We're using PHP 4.3.10 with MMTurk cache and Zend optimisation enabled and using the same php.ini on both...
1
by: lilOlMe | last post by:
Can you install IIS6 on a system other than Windows Server 2003? I'd like to install IIS6 on Windows XP. I've been trying to find out the system requirements for IIS6 but I haven't found a clear...
4
by: Frank Lopes | last post by:
I've seen many people asking the same question in other forums but I haven't been able to solve this problem. First the environment: Windows Vista Ultimate running IIS6 Now the story:...
2
by: David Thielen | last post by:
So we have moved our app from .NET version 2.X in IIS6 to a Windows 2008 Server running IIS7. We have copied all files to the Windwardreports\apps directory and that apps directory has been...
4
by: jessiK | last post by:
Pls help! I'm new to PHP and MySQL and I'm having a problem when working with my database (I am using IIS6). When using PHP I can connect to the database without any problems, I can even add new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.