This may not be it but did you check the database to see what info is being
passed to $record = $results[0]; or you can check the HTML page that $word =
param("word"); gets its info from?

-----Original Message-----
From: Matthew Harrison [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 22, 2002 4:00 PM
To: bob ackerman
Cc: [EMAIL PROTECTED]
Subject: Re: joining 2 strings


the script is part of a web-based role-playing-game. the line in question 
is in the sub called 'add':

#!/usr/bin/perl

###Vars and modules###

use CGI qw/:standard/;
use CGI::Carp "fatalsToBrowser";
use DBI;

$action = param('action');
$word = param('word');
$rd1 = param('rd1');
$rd2 = param('rd2');
$goback = referer();
$red1 = "/flands/book2/book2.cgi?page=".$rd1;
$red2 = "/flands/book2/book2.cgi?page=".$rd2;

###Actions###

if ($action eq "lookup"){
    lookup();
}
if ($action eq "add"){
    add();
}
if ($action ne "lookup" && $action ne "add"){
    print "Location: $goback\n\n";
}

###Sub Lookup###

sub lookup{

$dbh = new CGI;
$dbh=DBI->connect("DBI:mysql:database=flands;host=127.0.0.1;port=3306",edhun
ter,137842533114953);
die "Could not connect to database" if !$dbh;

$sth = $dbh->prepare("SELECT codewords FROM chars WHERE id = '$id'");
if ($sth && $sth->execute()){
    @results = $sth->fetchrow_array();
}
$record = $results[0];




if ($record =~ /$word/g) {
    print "Location: $red1\n\n";
} else {
    print "Location: $red2\n\n";
}
}


###Sub Add###

sub add{

$dbh = new CGI;
$dbh=DBI->connect("DBI:mysql:database=flands;host=127.0.0.1;port=3306",edhun
ter,137842533114953);
die "Could not connect to database" if !$dbh;

$sth = $dbh->prepare("SELECT codewords FROM chars WHERE id = '$id'");
if ($sth && $sth->execute()){
    @results = $sth->fetchrow_array();
}
$record = $results[0];

if ($record =~ /$word/g) {
    print "Location: $goback\n\n";
} 
else {

$newrec = $record.','.$word;
    
$dbh = new CGI;
$dbh=DBI->connect("DBI:mysql:database=flands;host=127.0.0.1;port=3306",edhun
ter,137842533114953);
die "Could not connect to database" if !$dbh;

$sth = $dbh->prepare("UPDATE chars SET codewords = '$newrec' WHERE id = 
'$id'");
if ($sth && $sth->execute()){
}
}
    print "Location: $goback\n\n";
}




On Friday 22 Mar 2002 11:56 pm, bob ackerman wrote:
> maybe you could show what is in $stringa and $stringb.
> show a few lines before and after the line with the error.
> there isn't anything wrong with the line as it is here.
>
> On Friday, March 22, 2002, at 03:51  PM, Matthew Harrison wrote:
> > the semicolon was in my script i jsut forgot to put in in my email.
> > sorry.
> >
> > On Friday 22 Mar 2002 11:51 pm, bob ackerman wrote:
> >> did it say the error was on the line you are showing below, or on the
> >> next line?
> >> i am getting at asking if you really end the line with semicolon or
> >> not.
> >>
> >> On Friday, March 22, 2002, at 03:46  PM, Matthew Harrison wrote:
> >>> it said scalar found where operator expected.
> >>>
> >>> On Friday 22 Mar 2002 11:44 pm, bob ackerman wrote:
> >>>> what did it say the problem was?
> >>>> that line is missing a semicolon at end.
> >>>>
> >>>> On Friday, March 22, 2002, at 03:40  PM, Matthew Harrison wrote:
> >>>>> i need to join $stringa to $stringb with a coma in the middle (no
> >>>>> whitespaces). i have tried
> >>>>>
> >>>>> $stringc = $stringa.",".$stringb
> >>>>>
> >>>>> but it says there is a problem. what should it be?
> >>>>>
> >>>>> --
> >>>>> Matthew Harrison
> >>>>> Internet/Network Services Administrator
> >>>>> Peanut-Butter Cheesecake Hosting Services
> >>>>> Genstate
> >>>>> www.peanutbuttercheesecake.co.uk
> >>>>>
> >>>>> --
> >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>>>> For additional commands, e-mail: [EMAIL PROTECTED]
> >>>
> >>> --
> >>> Matthew Harrison
> >>> Internet/Network Services Administrator
> >>> Peanut-Butter Cheesecake Hosting Services
> >>> Genstate
> >>> www.peanutbuttercheesecake.co.uk
> >
> > --
> > Matthew Harrison
> > Internet/Network Services Administrator
> > Peanut-Butter Cheesecake Hosting Services
> > Genstate
> > www.peanutbuttercheesecake.co.uk

-- 
Matthew Harrison
Internet/Network Services Administrator
Peanut-Butter Cheesecake Hosting Services
Genstate
www.peanutbuttercheesecake.co.uk

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to