2010-02-07 8 views
1

일부 파일은 사용할 수 있지만 모두는 아니지만 데이터베이스에서 HTML을 업로드하려고합니다.HTML을 데이터베이스로 업로드 - PERL

my $fileContents; 
if($md5Con =~ m/\.php$/g) { 
    my $ftp = Net::FTP->new($DB_ftpserver, Debug => 0) or die "Cannot connect to some.host.name: [email protected]"; 
    $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>; 
     #print $fileContents; 
     my $bodyContents; 
     my $headContents; 

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

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

      $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; 
      $dbh->do("INSERT INTO $headerTable (headData, headDataOutput) VALUES ($headContents, $headContents)") or die " error: Couldn't connect to database: " . DBI->errstr; 
      $dbh->do("INSERT INTO $bodyTable (bodyData, bodyDataOutput) VALUES ($bodyContents, $bodyContents)") or die " error: Couldn't connect to database: " . DBI->errstr; 
      $dbh->do("INSERT INTO page_names (linkFromRoot, linkTrue, page_name, table_name, navigation, location) VALUES ($linkFromRoot, $linkTrue, $page_name, $table_name, $navigation, $location)") or die " error: Couldn't connect to database: " . DBI->errstr; 

      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; 
} 

왜 이런 일이 일어날 지 알 수 있습니까?

다른 각도에서보고, 편집,이 데이터베이스로가는 데이터의 출력이 ... 코드의 첫 번째 3 개 블록은 네 번째에 잘 다음 오류로 이동합니다.

<span class="green">http://www.themobilemakeover.co.uk/index.php</span><br /> 

'<?php session_start(); ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"h 
ttp://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"description\" content=\"The Mo 
bile Makeover offers a wide range of services and treatments all from the luxuary of your own home!\" />\n<meta name=\"keywords\" content=\"Mobile Makeover, B 
eauty Therapist, Beautician, Therapist, Mobile Therapist, Mansfield, Nottinghamshire\" />\n<meta name=\"language\" content=\"en\" />\n<meta name=\"author\" co 
ntent=\"ACT Web Designs\" />\n<meta name=\"copyright\" content=\"The Mobile Makeover\" />\n<meta name=\"publisher\" content=\"ACT Web Designs\" />\n<meta name 
=\"country\" content=\"United Kingdom\" />\n<meta name=\"city\" content=\"Mansfield, Nottinghamshire\" />\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8 
\" /> \n<meta name=\"verify-v1\" content=\"4lZIaMmjLMq+UA8nkPYB9RjF5RreNwF3Mzurm9JYvQM=\" />\n<title>The Mobile Makeover - Mobile Beautician</title>\n<link hr 
ef=\"stylesheets/main.css\" rel=\"stylesheet\" type=\"text/css\" />\n<link href=\"stylesheets/cssReset.css\" rel=\"stylesheet\" type=\"text/css\" />\n<script 
type=\"text/javascript\" src=\"js/jquery-1.3.1.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery.bgpos.js\"></script>\n<script type=\"text/java 
script\" src=\"js/jquery.timers.js\"></script>\n<script type=\"text/javascript\" src=\"js/makeover.scroll.js\"></script>\n<script type=\"text/javascript\">\nv 
ar gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src=\'\" + gaJsHost + \" 
google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTr 
acker(\"UA-8193659-6\");\npageTracker._trackPageview();\n} catch(err) {}</script></head>' 

<span class="green">http://www.themobilemakeover.co.uk/about-us-the-mobile-makeover.php</span><br /> 

'<?php session_start(); ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"h 
ttp://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"description\" content=\">My na 
me 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 cours 
es and training...\" />\n<meta name=\"keywords\" content=\"Mobile Makeover, About Us, Beauty Therapist, Mobile Therapist, Mansfield, Nottinghamshire\" />\n<me 
ta name=\"language\" content=\"en\" />\n<meta name=\"author\" content=\"ACT Web Designs\" />\n<meta name=\"copyright\" content=\"The Mobile Makeover\" />\n<me 
ta name=\"publisher\" content=\"ACT Web Designs\" />\n<meta name=\"country\" content=\"United Kingdom\" />\n<meta name=\"city\" content=\"Mansfield, Nottingha 
mshire\" />\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" /> \n<title>The Mobile Makeover - About Us</title>\n<link href=\"stylesheets/main.css\" rel 
=\"stylesheet\" type=\"text/css\" />\n<link href=\"stylesheets/cssReset.css\" rel=\"stylesheet\" type=\"text/css\" />\n<script type=\"text/javascript\" src=\" 
js/jquery-1.3.1.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery.bgpos.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery.timers 
.js\"></script>\n<script type=\"text/javascript\" src=\"js/makeover.scroll.js\"></script>\n<script type=\"text/javascript\">\nvar gaJsHost = ((\"https:\" == d 
ocument.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src=\'\" + gaJsHost + \"google-analytics.com/ga.js\' ty 
pe=\'text/javascript\'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker(\"UA-8193659-6\");\npageT 
racker._trackPageview();\n} catch(err) {}</script></head>' 

<span class="green">http://www.themobilemakeover.co.uk/beauty-products-used.php</span><br /> 

'<?php session_start(); ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"h 
ttp://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<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.\" />\n<meta name=\"keywords\" content=\"Mobile Makeover, Beauty Therapist, Beauty Products, Jessica, Calgel, Eve Tay 
lor, Tantrick, Therapist, Mansfield, Nottinghamshire\" />\n<meta name=\"language\" content=\"en\" />\n<meta name=\"author\" content=\"ACT Web Designs\" />\n<m 
eta name=\"copyright\" content=\"The Mobile Makeover\" />\n<meta name=\"publisher\" content=\"ACT Web Designs\" />\n<meta name=\"country\" content=\"United Ki 
ngdom\" />\n<meta name=\"city\" content=\"Mansfield, Nottinghamshire\" />\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" /> \n<title>The Mobile Makeov 
er - Beauty Products Used</title>\n<link href=\"stylesheets/main.css\" rel=\"stylesheet\" type=\"text/css\" />\n<link href=\"stylesheets/cssReset.css\" rel=\" 
stylesheet\" type=\"text/css\" />\n<!--[if lte IE 6]><link href=\"stylesheets/mainie6.css\" rel=\"stylesheet\" type=\"text/css\" /><![endif]-->\n<script type= 
\"text/javascript\" src=\"js/jquery-1.3.1.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery.bgpos.js\"></script>\n<script type=\"text/javascrip 
t\" src=\"js/jquery.timers.js\"></script>\n<script type=\"text/javascript\" src=\"js/makeover.scroll.js\"></script>\n<script type=\"text/javascript\">\nvar ga 
JsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src=\'\" + gaJsHost + \"googl 
e-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E\"));\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker 
(\"UA-8193659-6\");\npageTracker._trackPageview();\n} catch(err) {}</script></head>' 

<span class="green">http://www.themobilemakeover.co.uk/beauty-treatments.php</span><br /> 

'<?php session_start(); ?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"h 
ttp://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n<meta name=\"description\" content=\"The Mo 
bile Makeover offers a wide range of treatments all from the luxuary of your own home!\" />\n<meta name=\"keywords\" content=\"Mobile Makeover, Beauty Treatme 
nts, Beautician, Facials, Pedicures, Hopi Ear Candles, Eye Treatments, Mansfield, Nottinghamshire\" />\n<meta name=\"language\" content=\"en\" />\n<meta name= 
\"author\" content=\"ACT Web Designs\" />\n<meta name=\"copyright\" content=\"The Mobile Makeover\" />\n<meta name=\"publisher\" content=\"ACT Web Designs\"/
>\n<meta name=\"country\" content=\"United Kingdom\" />\n<meta name=\"city\" content=\"Mansfield, Nottinghamshire\" />\n<meta http-equiv=\"X-UA-Compatible\" c 
ontent=\"IE=8\" /> \n<title>The Mobile Makeover - Beauty Treatments</title>\n<link href=\"stylesheets/main.css\" rel=\"stylesheet\" type=\"text/css\" />\n<lin 
k href=\"stylesheets/cssReset.css\" rel=\"stylesheet\" type=\"text/css\" />\n<script type=\"text/javascript\" src=\"js/jquery-1.3.1.js\"></script>\n<script ty 
pe=\"text/javascript\" src=\"js/jquery.bgpos.js\"></script>\n<script type=\"text/javascript\" src=\"js/jquery.timers.js\"></script>\n<script type=\"text/javas 
cript\" src=\"js/makeover.scroll.js\"></script>\n<script type=\"text/javascript\">\nvar gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl 
.\" : \"http://www.\");\ndocument.write(unescape(\"%3Cscript src=\'\" + gaJsHost + \"google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E\")) 
;\n</script>\n<script type=\"text/javascript\">\ntry {\nvar pageTracker = _gat._getTracker(\"UA-8193659-6\");\npageTracker._trackPageview();\n} catch(err) {}< 
/script></head>' 


DBD::mysql::db do failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea 
r '22e64cef7d70fa952ce7444f158e2c4e_header (headData, headDataOutput) VALUES ('<' at line 1 at C:\perlscripts\cgitest.pl line 360, <FILE> chunk 4. 

error: Couldn't connect to database: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synta 
x to use near '22e64cef7d70fa952ce7444f158e2c4e_header (headData, headDataOutput) VALUES ('<' at line 1 at C:\perlscripts\cgitest.pl line 360, <FILE> chunk 
4. 

>>>>>> 편집 2 < < < < < < < < <

추적을 사용한 후 나는 더 현명 비입니다.

DBI 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, 
+0

아마도 테이블 이름을()/자리 표시 자로 지정해야 할 수도 있습니다. 또는 실패한 createXtable입니까? 그게 어디 정의 된 볼 수 없습니다 ... 당신이 모든 내장 된 SQL 문을 로그 파일에 기록하는 것이 좋습니다. 그러면 아마도 문제가 어디 있는지 알 수 있습니다. – FalseVinylShrub

+2

문제가 발생하면 가능한 가장 작은 스크립트를 만들어 문제를 보여줍니다. 이렇게하면 질문의 초점을 좁히고 대답 할 수있는 사람으로부터 정보를 혼란스럽게 할 수 있습니다. :) –

+1

SQL 명령 내에서 가변 보간?"글쎄 거기에 문제가 ..." – jrockway

답변

3

잘못 무슨 일이 일어나고 있는지 확실히 볼 어렵다 (이 지금 "따옴표()"를 사용하여 자리를 제거하고),하지만 난 안드레아스 Bonini은 '당신이 올바른 생각 : 여기 내 로그입니다 인용 문제가있어.

그러나, 그는 실수로 같은 효과를 DBI의 quote method를 사용할 수있는 PHP 함수 ;-)

당신을 언급했다. (업데이트 : oops, 이미 데이터 항목에 사용했으나 테이블 이름 변수에도 사용할 필요가 있습니다.)

그러나 대부분의 사람들이 placeholder values :

while (something) { 
    # I've imagined you're looping over the data 

    $dbh->do("INSERT INTO $headerTable (headData, headDataOutput) 
     VALUES ($headContents, $headContents)") 
     or die " error: Couldn't connect to database: " . DBI->errstr; 
} 

가된다 :

my $sth = $dbh->prepare("INSERT INTO ? (headData, headDataOutput) 
        VALUES (?, ?)") 
        or die " error: Couldn't prepare : " . DBI->errstr;) 

# later... 
while (something) { 
    # loop over the data 

    $sth->execute($headerTable, $headContents, $headContents) 
     or die "couldn't execute: " . $sth->errstr; 
} 

안된 ... 죄송합니다 ;-)

나는 테이블 이름에 대해 자리 표시자를 사용할 수 있는지 확신 할 수는 없지만 그 이유는 모르겠다. 그래서 시도해 보길 권한다. 그렇지 않다면 위에서 설명한대로 테이블 이름을 quote()해야합니다.

루프 내에서 코드가 실행된다고 가정하면 루프 외부에서 문 핸들러 ($ sth)를 한 번 준비하고 여러 번 실행하면 많은 삽입 작업이 필요한 경우 시간이 절약됩니다.

HTH

+0

죄송합니다, 당신이 인용 했어() ... 코드가 아닌 코드를 너무 가깝게보고 싶지 않다. 어쨌든, 자리 표시자는 여전히 (보통) 좋은 것이므로 그것을 떠날거야. – FalseVinylShrub

+0

시간을내어 상기를 작성해 주셔서 감사합니다! 지주를 찾으려 할 것입니다. 또한 테이블 이름에 대해 따옴표를 사용하여 시도했지만 오류를주고 couldnt은 그것을 둥글게했습니다 (나는 이상하게 생각했습니다). 나는 곧 다시 올 것이다. –

+0

위의 방법을 사용하면 내 DB의 데이터가 따옴표로 묶여 있으므로 따옴표가 자동으로 추가되는지 알고 계십니까? –

관련 문제