1
필자는 oracle 테이블에 삽입하고자하는 몇 가지 php 변수가 있지만 이스케이프 인용 부호로는 어려움을 겪고 있습니다.php 변수를 oracle 테이블에 삽입하는 방법은 무엇입니까?
는 여기에 지금까지이 작업은 다음과 같습니다
<?php
......
$number_passed=20;//this is calculated earlier in the code
$number_total=100;//also calculated earlier in the code
$date=date('m/d/y');
$username=//username here
$password=//password here
$database=//database connection string here
$connection=oci_connect($username,$password,$database);
$sql="INSERT INTO TEST_TABLE (Date_Col,num_pass,num_total)
VALUES ('"$date"','"$number_passed"','"$number_total"')";
$st= oci_parse($$connection, $sql);
oci_execute($st);
?>
나는이 작업을 수행 할 때, 나는 다음과 같은 오류를 얻을 : 내 SQL 문을 선언 라인에 구문 오류, 예기치 T_VARIABLE : 구문 분석 오류. PHP 변수를 데이터베이스 테이블에 올바르게 삽입하려면 어떻게해야합니까?
또한 데이터베이스에 삽입하기 전에 php 변수를 위생 처리해야한다는 것을 알고 있습니다. 저를위한 기능이 있습니까?
감사합니다.
연결보다는 매개 변수가있는 쿼리를 사용하십시오. – Dai
$ st = oci_parse ($$ connection, $ sql); ~ $ st = oci_parse ($ connection, $ sql); – fortune
오류를 찾아 주셔서 감사합니다. – user3266259