I've got a few php variables that I'd like to insert into an oracle table, but I'm having a hard time with the escape quotes.
Here's what I have so far:
<?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);
?>
When I do this, I get the following error :Parse error: syntax error, unexpected T_VARIABLE on the line where I declare my sql statement. How do I insert the php variables into the database table correctly?
Also, I know I'm supposed to sanitize my php variables before inserting them into the database. Is there a function that does that for me?
Thank you!