0
저는 아주 간단한 SQL 데이터베이스에 삽입하려고하는이 PDO 비트가 있습니다. 콘솔에서는 PHP에서 print_r()이 정확히 내가 원하는 응답을 제공한다고 보여줍니다. - 필드가 SQL dBase에 삽입되지 않습니다. 이 도움이 될 것입니다 경우
, 내가이 잘못하고있는 중이 야하는 것은? : 제발
나는 두 개의 사진이 있습니다
응답 : http://extoleducation.ipage.com/extol/test/functioning/test/pic1.png
디베이스 : http://extoleducation.ipage.com/extol/test/functioning/test/pic2.png
<?php
$pdo = new PDO("mysql:host=extoleducation.ipagemysql.com;dbname=trialdb","username","password");
if(isset($_POST['sample1'])) {
$sql = "INSERT INTO `sampletable` (`sampleline1`, 'sampleline2', 'sampleline3', 'sampleline4') VALUES (:sample1, :sample2, :sample3, :sample4)";
$query = $pdo->prepare($sql);
$query->execute(array(':sample1'=>$_POST['sample1'],':sample2'=>$_POST['sample2'],':sample3'=>$_POST['sample3'],':sample4'=>$_POST['sample4']));
\t print_r($_POST['sample1'], $_POST['sample2'], $_POST['sample3'],$_POST['sample4']);
}
저는 여기에서 추측하고 있지만 삽입 쿼리에서 작은 따옴표 (')와 백틱 (')을 사용하고 있습니다. 백틱 만 사용하여 시도해보십시오. –
Brilliant! 그랬지, 고마워! – MekLeN
문제 없음 :) 다행스럽게 도와 드릴 수있었습니다. –