Does it have the same error if you change the line to this?

$newrec = "$record,$word";

-----Original Message-----
From: Matthew Harrison
To: bob ackerman
Cc: [EMAIL PROTECTED]
Sent: 3/22/02 3:59 PM
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",e
dhunter,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",e
dhunter,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",e
dhunter,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]


--------------------------------------------------------------------------------
This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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

Reply via email to