There is nothing wrong with the line that does the concatenation in sub 'add'. You have a problem somewhere else it seems. What was the exact error again?
- Jim At 23:59 03.22.2002 +0000, Matthew Harrison wrote: >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",edhunter,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",edhunter,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",edhunter,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] -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.0.6 (MingW32) Comment: For info see http://www.gnupg.org - Jim Philosophy is for those who have nothing better to do than wonder why philosophy is for those who have nothing better to do than... mQGiBDxAonQRBACx+sz63XIeo5uTzc5n3Elf7Y13VVZGIM8Pilp3LpBu70/nGQPu anKYDB3aa1U5cfl+cTK5lOtUxN7Fu0a2Uv0ApIlC1qA8CjDZqlu7PDETFTVrpfGZ 007BHO+y2Y0bVsaMPXdnhbi0LAFSIkNYRhyzNWbAkeMsgA+i2k9hcnhvVwCgor7P nflXu7xWN9aWt3RJBzqdUR0EAK/1obJFUKQSK39cKTMPQ4u2UPflbS5dJ871naG5 xBAlQAjHAXT+f/fXE2ezrSyoQnlOD4kVbPN3gB5UT5mWoylPuf5W7WmupthVzUUN IsPDbmAT0YOwgALCfJVS+PrPCC8opmZhTjQBwgxCSY9MWULlzN3X2EEDqWIxluYb o5W/BACgHA+aFOO5F03QZBBScWn9YBS1ZH3sSlkQEK5RiwGXLmHJacOjn660SbOE MEKPDLDDJu/vt1fb3VRLc/fPB3aB7fi4XagfobaHbID9rx55slLhD94Q+5JuJSfg DyJ+vVSA1k+9/SynflPl0QY5zt0xSM+0CBg9mBg2bPyuGsDwXLQ5SmltIENvbm5l ciAoTmV3IEdQRyBLZXkgZm9yIFNuYWZ1WCkgPGpjb25uZXJAZW50ZXJpdC5jb20+ iFcEExECABcFAjxAonQFCwcKAwQDFQMCAxYCAQIXgAAKCRDmnFh04+r7ZdFiAKCh t8Vq7ZT6qvh9Dzn0lzZXRM4gywCfSLU/H5UHX7ZoxapfDs9pLxEEZeO5Ag0EPECj chAIAIsdwiPqW8IsumvpXu59qkfsi4H2nofxvbhMDiapEhgloydehNQOEiHwC/O1 a06PjUmNRLRdK88kjy99R84ILbWUJZUclQB2LcjlttnrIG/FzCMxoLTKOeOCJk8N ONswBdJdcf/XqbWJBTs/MXeNf4rmShYi6WJ5+jc1IE5PXGf4SR/9bz2r+/GESlrX tAoNtWl5a/NUxb6b0hR6zU9Y6oO1vpDDJNbcV9mafdYhsvoFYdD2c6JF+JoN+FHR tEP3k6leYwQ5P0kuUQNgWdWNWZfBq1tQDBfhg1/AV0JBzamyJfd0prFmtUEemKx4 haDsOoT4gLSPNTqSsyDt6TNLtGMAAwUIAINeot1FVpree5bvhy3xL+Pr1UGb++DM b8Qeer6ERkVQNx7YoU8hfpqOwvEQMyfb9s6HPfSWRUfQRF+g+9ohPgYkH+1nqH3V PtGSw1kgLOqxZQTVPEcAMhSflt9LSJETIQQByKKh1e5RvOuApwBFmQq3syRhzqv/ j2b6t3IqAB9WR5TnoYkdUtTWM9MGubiFl5B9uH5EHWAlFF8h760U7Xp9m1J3qTyH EJqjfGj2SP2DK5cisuWOWdPy5aSqT7ZKrcKeSTDUyiHclI1ygFHue8oO0HXqrs+k KjFdRqIKnzfY9gW/b/6gLHhBDV6BoA9w6+1Y9egOByRcVonE8zY/xMeIRgQYEQIA BgUCPECjcgAKCRDmnFh04+r7ZcyDAJ4ogYX7W4u8g+QJsksyL4Ld+dObCwCfU7hB 7I3ZgTsYwP6mr5RPjkH5PG8= =QOu8 -----END PGP PUBLIC KEY BLOCK----- __END__ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]