-5

I have errors when inserting into my database. I have tried everything to sus this. Someone mentioned usind DBI's trace() to track what is going wrong but i cannot make heads or tails of what is going on. Could someone please take a look and see what they think might be the problem.

D

BI 1.607-ithread default trace level set to 0x0/1 (pid 13524) at cgitest.pl line 10
    -> DBI->connect(*****************************************************)
    -> DBI->install_driver(mysql) for MSWin32 perl=5.010001 pid=13524 ruid=0 euid=0
       install_driver: DBD::mysql version 4.011 loaded from C:/Perl/site/lib/DBD/mysql.pm
    <- install_driver= DBI::dr=HASH(0x37be1fc)
    !! warn: 0 CLEARED by call to connect method
    <- connect('database=web110-accounts;host=79.170.44.110;', 'web110-accounts', ...)= DBI::db=HASH(0x37bdc8c) at DBI.pm line 638
    <- STORE('PrintError', 1)= 1 at DBI.pm line 690
    <- STORE('AutoCommit', 1)= 1 at DBI.pm line 690
    <- STORE('Username', 'web110-accounts')= 1 at DBI.pm line 693
    <> FETCH('Username')= 'web110-accounts' ('Username' from cache) at DBI.pm line 693
    <- connected(**********************************)= undef at DBI.pm line 699
    <- connect= DBI::db=HASH(0x37bdc8c)
    <- STORE('dbi_connect_closure', CODE(0x37c3634))= 1 at DBI.pm line 708
    <- prepare('SELECT * FROM accounts WHERE KI = '9096699576bcc810df5bc311650c4ebd' ')= DBI::st=HASH(0x37bda24) at cgitest.pl line 61
    <- execute= 1 at cgitest.pl line 62
    <- rows= '1' at cgitest.pl line 63
    <- fetchrow_hashref= HASH(0x37bd514)24keys row1 at cgitest.pl line 64
    <- finish= 1 at cgitest.pl line 71
    <- disconnect= 1 at cgitest.pl line 72
   ****************************************************************************
   ****************************************************************************
    <- STORE('PrintError', 1)= 1 at DBI.pm line 690
    <- STORE('AutoCommit', 1)= 1 at DBI.pm line 690
    <- STORE('Username', 'web110-db-2')= 1 at DBI.pm line 693
    <> FETCH('Username')= 'web110-db-2' ('Username' from cache) at DBI.pm line 693
    <- connected('DBI:mysql:database=web110-db-2;host=79.170.44.110;', 'web110-db-2', ...)= undef at DBI.pm line 699
    <- connect= DBI::db=HASH(0x3d615ac)
    <- STORE('dbi_connect_closure', CODE(0x3d60f6c))= 1 at DBI.pm line 708
    <- prepare('INSERT INTO ? ( headData, headDataOutput ) VALUES ( ?, ? )')= DBI::st=HASH(0x351659c) at cgitest.pl line 263
    <- prepare('INSERT INTO ? ( bodyData, bodyDataOutput ) VALUES ( ?, ? )')= DBI::st=HASH(0x37bd914) at cgitest.pl line 264
    <- prepare('INSERT INTO page_names (linkFromRoot, linkTrue, page_name, table_name, navigation, location) VALUES ( ?, ?, ?, ?, ?, ? )')= DBI::st=HASH(0x3d575fc) at cgitest.pl line 265
    <- quote("http://www.themobilemakeover.co.uk/index.php")= "'http://www.themobilemakeover.co.uk/index.php'" at cgitest.pl line 271
    <- prepare("SELECT * FROM page_names WHERE linkTrue = 'http://www.themobilemakeover.co.uk/index.php' ")= DBI::st=HASH(0x3d571bc) at cgitest.pl line 272
    <- execute= '0E0' at cgitest.pl line 273
    <- rows= '0' at cgitest.pl line 274
    <- quote("The Mobile Makeover - Mobile Beautician")= "'The Mobile Makeover - Mobile Beautician'" at cgitest.pl line 289
    <- prepare("SELECT * FROM page_names WHERE page_name = 'The Mobile Makeover - Mobile Beautician' ")= DBI::st=HASH(0x3d56fdc) at cgitest.pl line 290
    <- execute= '0E0' at cgitest.pl line 291
    <- rows= '0' at cgitest.pl line 292
    <- DESTROY(DBI::st=HASH(3d54254))= undef at cgitest.pl line 287
    <- do('CREATE TABLE IF NOT EXISTS `6959bbd13fdb4df586a5b9d08aae1153_body` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `bodyData` TEXT NOT NULL, 
                    `bodyDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 362
    <- do('CREATE TABLE IF NOT EXISTS `6959bbd13fdb4df586a5b9d08aae1153_header` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `headData` TEXT NOT NULL, 
                    `headDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 363
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''6959bbd13fdb4df586a5b9d08aae1153_header' ( headData, headDataOutput ) VALUES ( ' at line 1' (err#0)
    <- execute('6959bbd13fdb4df586a5b9d08aae1153_header', '<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="The Mobile Makeover offers a wide range of services and treatments all from the luxuary of your own home!" />
<meta name="keywords" content="Mobile Makeover, Beauty Therapist, Beautician, Therapist, Mobile Therapist, Mansfield, Nottinghamshire" />
<meta name="language" content="en" />
<meta name="author" content="ACT Web Designs" />
<meta name="copyright" content="The Mobile Makeover" />
<meta name="publisher" content="ACT Web Designs" />
<meta name="country" content="United Kingdom" />
<meta name="city" content="Mansfield, Nottinghamshire" />
<meta http-equiv="X-UA-Compatible" content="IE=8" /> 
<meta name="verify-v1" content="4lZIaMmjLMq+UA8nkPYB9RjF5RreNwF3Mzurm9JYvQM=" />
<title>The Mobile M...', ...)= undef at cgitest.pl line 365
    !! ERROR: 1064 CLEARED by call to execute method
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''6959bbd13fdb4df586a5b9d08aae1153_body' ( bodyData, bodyDataOutput ) VALUES ( '<' at line 1' (err#0)
    <- execute('6959bbd13fdb4df586a5b9d08aae1153_body', '<body>
    <div id="wrapper">
        <div id="header">
            <div id="innerHeader">
                <h1><span>The Mobile Makeover - Mobile Beauty Therapist - Mansfield Nottinghamshire</span></h1>
                <div class="clear"></div>
                <?php include("php/navigation.php"); ?>
                <div class="clear"></div>
            </div>
        </div>
        <div id="main">
            <div id="content1" class="content vis">
                <h2>Welcome to The Mobile Makeover</h2>
                <div class="image1">
                </div>
                <p>Home visit appointments are designed to save you time and stress, by providing a service in the comfort of your own home, no need to worry about travel and traffic or facing the cold night air after a relaxing treatment.</p>
                <p>If you have a baby or a toddler The Mobile Makeover can help you put together a package of <a href="beauty-treatments.php" title="link to treatments page">treatments</a> that is ada...', ...)= undef at cgitest.pl line 366
    !! ERROR: 1064 CLEARED by call to execute method
    <- execute("public_html/index.php", "http://www.themobilemakeover.co.uk/index.php", ...)= 1 at cgitest.pl line 367
    <- DESTROY(DBI::st=HASH(3d56f5c))= undef at cgitest.pl line 270
    <- quote("http://www.themobilemakeover.co.uk/about-us-the-mobile-makeover.php")= "'http://www.themobilemakeover.co.uk/about-us-the-mobile-makeover.php'" at cgitest.pl line 271
    <- prepare("SELECT * FROM page_names WHERE linkTrue = 'http://www.themobilemakeover.co.uk/about-us-the-mobile-makeover.php' ")= DBI::st=HASH(0x3d56d9c) at cgitest.pl line 272
    <- execute= '0E0' at cgitest.pl line 273
    <- rows= '0' at cgitest.pl line 274
    <- quote("The Mobile Makeover - About Us")= "'The Mobile Makeover - About Us'" at cgitest.pl line 289
    <- prepare("SELECT * FROM page_names WHERE page_name = 'The Mobile Makeover - About Us' ")= DBI::st=HASH(0x3b07814) at cgitest.pl line 290
    <- execute= '0E0' at cgitest.pl line 291
    <- rows= '0' at cgitest.pl line 292
    <- DESTROY(DBI::st=HASH(3d54254))= undef at cgitest.pl line 287
    <- do('CREATE TABLE IF NOT EXISTS `30df18a64311aa9aaaa9576b030f0f83_body` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `bodyData` TEXT NOT NULL, 
                    `bodyDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 362
    <- do('CREATE TABLE IF NOT EXISTS `30df18a64311aa9aaaa9576b030f0f83_header` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `headData` TEXT NOT NULL, 
                    `headDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 363
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''30df18a64311aa9aaaa9576b030f0f83_header' ( headData, headDataOutput ) VALUES ( ' at line 1' (err#0)
    <- execute('30df18a64311aa9aaaa9576b030f0f83_header', '<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content=">My name is Kelly Knight, I am a highly Qualifed Mobile Beauty Therapist. I have trained in NVQ Level 2 and NVQ level 3 in Beauty Therapy with many additional courses and training..." />
<meta name="keywords" content="Mobile Makeover, About Us, Beauty Therapist, Mobile Therapist, Mansfield, Nottinghamshire" />
<meta name="language" content="en" />
<meta name="author" content="ACT Web Designs" />
<meta name="copyright" content="The Mobile Makeover" />
<meta name="publisher" content="ACT Web Designs" />
<meta name="country" content="United Kingdom" />
<meta name="city" content="Mansfield, Nottinghamshire" />
<meta http-equiv="X-UA-Compatible" content="IE=8" /> 
<title>The Mobile Makeover - About U...', ...)= undef at cgitest.pl line 365
    !! ERROR: 1064 CLEARED by call to execute method
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''30df18a64311aa9aaaa9576b030f0f83_body' ( bodyData, bodyDataOutput ) VALUES ( '<' at line 1' (err#0)
    <- execute('30df18a64311aa9aaaa9576b030f0f83_body', '<body id="aboutUsPage">
    <div id="wrapper">
        <div id="header">
            <div id="innerHeader">
                <h1><span>The Mobile Makeover - About Us</span></h1>
                <div class="clear"></div>
                <?php include("php/navigation.php"); ?>
                <div class="clear"></div>
            </div>
        </div>
        <div id="main">
            <div id="content1" class="content vis">
                <h2>About Us - Kelly Night</h2>
                <div class="image1">
                </div>
                <p>My name is Kelly Knight, I am a highly Qualified Mobile Beauty Therapist. I have trained in NVQ Level 2 and NVQ level 3 in Beauty Therapy with many additional courses and training gained within my time in the beauty industry. I have gained my years of experience from working at one of the UK's biggest Hotels &amp; Spa chains where i worked as a salon supervisor. After being approached by a number of people to go mobile to their homes i recognised that the...', ...)= undef at cgitest.pl line 366
    !! ERROR: 1064 CLEARED by call to execute method
    <- execute("public_html/about-us-the-mobile-makeover.php", "http://www.themobilemakeover.co.uk/about-us-the-mobile-makeover.php", ...)= 1 at cgitest.pl line 367
    <- DESTROY(DBI::st=HASH(3d56f1c))= undef at cgitest.pl line 270
    <- quote("http://www.themobilemakeover.co.uk/beauty-products-used.php")= "'http://www.themobilemakeover.co.uk/beauty-products-used.php'" at cgitest.pl line 271
    <- prepare("SELECT * FROM page_names WHERE linkTrue = 'http://www.themobilemakeover.co.uk/beauty-products-used.php' ")= DBI::st=HASH(0x3d56f3c) at cgitest.pl line 272
    <- execute= '0E0' at cgitest.pl line 273
    <- rows= '0' at cgitest.pl line 274
    <- quote("The Mobile Makeover - Beauty Products Used")= "'The Mobile Makeover - Beauty Products Used'" at cgitest.pl line 289
    <- prepare("SELECT * FROM page_names WHERE page_name = 'The Mobile Makeover - Beauty Products Used' ")= DBI::st=HASH(0x3d545a4) at cgitest.pl line 290
    <- execute= '0E0' at cgitest.pl line 291
    <- rows= '0' at cgitest.pl line 292
    <- DESTROY(DBI::st=HASH(3d54684))= undef at cgitest.pl line 287
    <- do('CREATE TABLE IF NOT EXISTS `02b5f135f611c1d7b0ec090182bc6cf5_body` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `bodyData` TEXT NOT NULL, 
                    `bodyDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 362
    <- do('CREATE TABLE IF NOT EXISTS `02b5f135f611c1d7b0ec090182bc6cf5_header` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `headData` TEXT NOT NULL, 
                    `headDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;')= '0E0' at cgitest.pl line 363
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''02b5f135f611c1d7b0ec090182bc6cf5_header' ( headData, headDataOutput ) VALUES ( ' at line 1' (err#0)
    <- execute('02b5f135f611c1d7b0ec090182bc6cf5_header', '<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="We use a wide range of the finest products on the market today. Below is a short brief of just a few of the names which we believe give you the best results - we do not compromise when it comes to quality." />
<meta name="keywords" content="Mobile Makeover, Beauty Therapist, Beauty Products, Jessica, Calgel, Eve Taylor, Tantrick, Therapist, Mansfield, Nottinghamshire" />
<meta name="language" content="en" />
<meta name="author" content="ACT Web Designs" />
<meta name="copyright" content="The Mobile Makeover" />
<meta name="publisher" content="ACT Web Designs" />
<meta name="country" content="United Kingdom" />
<meta name="city" content="Mansfield, Nottinghamshire" />
<meta http-equiv="X-UA-Compa...', ...)= undef at cgitest.pl line 365
    !! ERROR: 1064 CLEARED by call to execute method
    !! ERROR: 1064 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''02b5f135f611c1d7b0ec090182bc6cf5_body' ( bodyData, bodyDataOutput ) VALUES ( '<' at line 1' (err#0)
    <- execute('02b5f135f611c1d7b0ec090182bc6cf5_body', '<body id="aboutUsPage">
    <div id="wrapper">
        <div id="header">
            <div id="innerHeader">
                <h1><span>The Mobile Makeover - Beauty Products</span></h1>
                <div class="clear"></div>
                <?php include("php/navigation.php"); ?>
                <div class="clear"></div>
            </div>
        </div>
        <div id="main">
            <div id="content1" class="content vis">
                <h2>Beauty products that we use</h2>
                <div class="image1">
                </div>
                <p>We use a wide range of the finest products on the market today. Below is a short brief of just a few of the names which we believe give you the best results - we do not compromise when it comes to quality.<br /> - <em>Kelly Knight</em></p>
            </div>
            <div class="content vis norm">
                <h2>Jessica</h2>
                <div class="image3">
                </div>
                <p>The Jessica &copy; nail products are de...', ...)= undef at cgitest.pl line 366
    !! ERROR: 1064 CLEARED by call to execute method
    <- execute("public_html/beauty-products-used.php", "http://www.themobilemakeover.co.uk/beauty-products-used.php", ...)= 1 at cgitest.pl line 367
    <- DESTROY(DBI::st=HASH(3d6982c))= undef at cgitest.pl line 270
    <- quote("http://www.themobilemakeover.co.uk/beauty-treatments.php")= "'http://www.themobilemakeover.co.uk/beauty-treatments.php'" at cgitest.pl line 271
    <- prepare("SELECT * FROM page_names WHERE linkTrue = 'http://www.themobilemakeover.co.uk/beauty-treatments.php' ")= DBI::st=HASH(0x3d56edc) at cgitest.pl line 272
    <- execute= '0E0' at cgitest.pl line 273
    <- rows= '0' at cgitest.pl line 274
    <- quote("The Mobile Makeover - Beauty Treatments")= "'The Mobile Makeover - Beauty Treatments'" at cgitest.pl line 289
    <- prepare("SELECT * FROM page_names WHERE page_name = 'The Mobile Makeover - Beauty Treatments' ")= DBI::st=HASH(0x3d6b48c) at cgitest.pl line 290
    <- execute= '0E0' at cgitest.pl line 291
    <- rows= '0' at cgitest.pl line 292
    <- DESTROY(DBI::st=HASH(3d6c674))= undef at cgitest.pl line 287
    <- do('CREATE TABLE IF NOT EXISTS `22e64cef7d70fa952ce7444f158e2c4e_body` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `bodyData` TEXT NOT NULL, 

>>> EDIT <<<<<<

I tried to post full code but wouldn't allow:

.
..
...

        my $headDataUpload = $dbh->prepare("INSERT INTO ? ( headData, headDataOutput ) VALUES ( ?, ? )") or die " error: Couldn't prepare : " . DBI->errstr;
        my $bodyDataUpload = $dbh->prepare("INSERT INTO ? ( bodyData, bodyDataOutput ) VALUES ( ?, ? )") or die " error: Couldn't prepare : " . DBI->errstr;
        my $insertData = $dbh->prepare("INSERT INTO page_names (linkFromRoot, linkTrue, page_name, table_name, navigation, location) VALUES ( ?, ?, ?, ?, ?, ? )") or die " error: Couldn't connect to database: " . DBI->errstr;


        foreach( @mainPagesArray ) {
            my $webpage = &extention(trim($_));
            if( trim($webpage) ne trim($domain) ){
                my $webpageQuote = $dbh->quote("http://www." . $webpage);
                my $sth = $dbh->prepare("SELECT * FROM page_names WHERE linkTrue = $webpageQuote ") or die "Could not select from table" . $DBI::errstr;
                $sth->execute(); 
                if( $sth->rows == 0 ) {
                    #output display pages found
                    print "<span class=\"green\">http://www." . $webpage . "</span><br />\n";
                    my $md5Con = "http://www." . $webpage;
                    my $linkTrue = "http://www." . $webpage;
                    $webpage =~ s/^$domain//g;
                    my $linkFromRoot = $root . $webpage;

                    my $getTitleContents = get($md5Con);
                    my $stringPageName;
                    if( $getTitleContents =~ m/<title>([^<]*)<\/title>/g ) {
                        my @titles = ($1);
                        my $counter = 2;
                        while(@titles){
                            my $currentTitle = shift @titles;
                            my $titleQuoted = $dbh->quote($currentTitle);
                            my $sth = $dbh->prepare("SELECT * FROM page_names WHERE page_name = $titleQuoted ") or die "Could not select from table" . $DBI::errstr;
                            $sth->execute(); 
                            if( $sth->rows == 0 ) {
                                $stringPageName = $currentTitle;
                                last;
                            }else{
                                my $newTitle = $currentTitle . "(" . $counter . ")";
                                push(@titles, $newTitle);
                                $counter ++;
                            }
                        }
                    }else{
                        my @titles = ('Untitled');
                        my $counter = 2;
                        while(@titles){
                            my $currentTitle = shift @titles;
                            my $titleQuoted = $dbh->quote($currentTitle);
                            my $sth = $dbh->prepare("SELECT * FROM page_names WHERE page_name = $titleQuoted ") or die "Could not select from table" . $DBI::errstr;
                            $sth->execute(); 
                            if( $sth->rows == 0 ) {
                                $stringPageName = $currentTitle;
                                last;
                            }else{
                                my $newTitle = $currentTitle . "(" . $counter . ")";
                                push(@titles, $newTitle);
                                $counter ++;
                            }
                        }                        
                    }

                    my $page_name = $stringPageName;
                    my $table_name = md5_hex($md5Con);
                    my $navigation = "1";
                    my $location = "1";

                    my $bodyTable = md5_hex($md5Con) . "_body";
                    my $headerTable = md5_hex($md5Con) . "_header";

                    my $createBodyTable = "CREATE TABLE IF NOT EXISTS `$bodyTable` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `bodyData` TEXT NOT NULL, 
                    `bodyDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;";

                    my $createHeadTable = "CREATE TABLE IF NOT EXISTS `$headerTable` (
                    `id` INT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                    `headData` TEXT NOT NULL, 
                    `headDataOutput` TEXT NOT NULL 
                    ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci;";

                    my $fileContents;
                    if( $md5Con =~ m/\.php$/g ) {
                        my $ftp = Net::FTP->new($DB_ftpserver, Debug => 0) or die "Cannot connect to some.host.name: $@";
                        $ftp->login($DB_ftpuser, $DB_ftppass) or die "Cannot login ", $ftp->message;
                        $ftp->get("/" . $root . $webpage, "c:/perlscripts/" . md5_hex($md5Con) . "-code.php") or die $ftp->message;
                        my $file = "c:/perlscripts/" . md5_hex($md5Con) . "-code.php";
                        {
                            local( $/ ); # undefine the record seperator
                            open FILE, "<", $file or die "Cannot open:$!\n";
                            my $fileContents = <FILE>;
                            my $bodyContents;
                            my $headContents;

                            my @contentsArray = split( /<\/head>/is, $fileContents, 2);

                            #print $contentsArray[1];
                            if( scalar @contentsArray == 2 ){
                                $bodyContents = trim($contentsArray[1]);
                                $headContents = trim($contentsArray[0]) . "</head>";

                                #print $headContents . "\n";

                                $dbh->do($createBodyTable) or die " error: Couldn't create body table: " . DBI->errstr;
                                $dbh->do($createHeadTable) or die " error: Couldn't create header table: " . DBI->errstr;

                                $headDataUpload->execute($headerTable, $headContents, $headContents);
                                $bodyDataUpload->execute($bodyTable, $bodyContents, $bodyContents);
                                $insertData->execute($linkFromRoot, $linkTrue, $page_name, $table_name, $navigation, $location);

                                #unlink("c:/perlscripts/" . md5_hex($md5Con) . "-code.php");

                            }else{
                                print "<span class=\"red\">" . $md5Con . " cannot be used by our CMS, invalid data.</span><br />\n";
                            }
                        }
                        $ftp->quit;
                    }elsif( $md5Con =~ m/(?:(?:\.asp)|(?:\.aspx))$/g ){

                    }                    
                }
            }
         }
      }else{
         print "<span class=\"red\"> error: No pages where found. This CMS is designed for pre-existing sites. Please contact support for more information.</span><br />\n";
      }

...
..
.
brian d foy
  • 129,424
  • 31
  • 207
  • 592
Phil Jackson
  • 10,238
  • 23
  • 96
  • 130
  • 3
    The name of the language is Perl. Not `perl` (that is the name of the binary) and certainly not PERL. Please keep that in mind. – Sinan Ünür Feb 07 '10 at 14:02
  • 5
    In any case, your fundamental problem is due to the fact that you seem to be creating a table (or maybe two) for each and every page. If that is correct, the battle was lost at the moment you made that decision. The rest is just detail. The bigger, even more fundamental, problem is that you seem to be using the "I'll throw everything I've got and see what sticks" method of programming which, to say the least, rarely works well. – Sinan Ünür Feb 07 '10 at 14:05
  • Im not sure whether that was an answer or not. You seem to have stated that you have some knowledge and know what your talking about. Me, on the other hand have been learning "Perl" for 2-3 weeks and do not, that is why I am asking for help. – Phil Jackson Feb 07 '10 at 14:49
  • 2
    Sinan Ünür is probably right... But I've no idea why your script is creating multiple tables, so... To fix this you're going to have to work out which SQL statement is failing and post a snippet that demonstrates it. Unfortunately, the DBI trace is hard to understand without being able to play about with your script. Change your script so that it prints out the SQL when there's a DBI error then use that to construct a script that illustrates the problem. If the data being inserted is large, try to cut it down to the smallest thing that still causes the problem. – FalseVinylShrub Feb 07 '10 at 14:49
  • For reference, this is a continuation of http://stackoverflow.com/questions/2216315/uploading-html-into-database-perl – FalseVinylShrub Feb 07 '10 at 14:55
  • 3
    Phil, just concentrate on cutting it down to a useful demonstration of your problem. If you don't work it out yourself by doing that, I'm sure someone will be able to work it out once you post the relevant information... ;-) – FalseVinylShrub Feb 07 '10 at 14:58
  • #$headDataUpload->execute($headerTable, $headContents, $headContents); #$bodyDataUpload->execute($bodyTable, $bodyContents, $bodyContents); These are the problem but I cant see why. I have replaced with: $headDataUpload->execute('6959bbd13fdb4df586a5b9d08aae1153_header', 'foo', 'bar'); $bodyDataUpload->execute('6959bbd13fdb4df586a5b9d08aae1153_header', 'bar', 'foo'); which still causes the error. – Phil Jackson Feb 07 '10 at 15:24
  • I seem to have got it to work. my $headDataUpload = $dbh->prepare("INSERT INTO `$headerTable` ( headData, headDataOutput ) VALUES ( ?, ? )") or die " error: Couldn't prepare : " . DBI->errstr; my $bodyDataUpload = $dbh->prepare("INSERT INTO `$bodyTable` ( bodyData, bodyDataOutput ) VALUES ( ?, ? )") or die " error: Couldn't prepare : " . DBI->errstr; $headDataUpload->execute($headContents, $headContents); $bodyDataUpload->execute($bodyContents, $bodyContents); – Phil Jackson Feb 07 '10 at 15:48
  • argh stupid formatting! backticks – Phil Jackson Feb 07 '10 at 15:50
  • 1
    Please edit the question instead of adding to it in comments. – brian d foy Feb 07 '10 at 21:25

1 Answers1

1

It would have been helpful to see just your query and the error that resulted, separate from all the trace information.

It looks to me like you are trying to use a placeholder for the table name, something that mysql doesn't support.

ysth
  • 96,171
  • 6
  • 121
  • 214