0

I'm trying to backup a table from oracle using php, and the table name should be new table_20171221. The date must insert current date when the table backup.

$date=date('Ymd');include("koneksi.php");
$query= 'CREATE TABLE new_table_`$date` AS SELECT * FROM old_table';
$statemen=oci_parse($c, $query);
oci_execute($statemen, OCI_DEFAULT);
oci_commit($c);

and the error messages :

Warning: oci_execute(): ORA-00911: invalid character in C:\xampp\htdocs\import_excel_v\create_table.php on line 7

and is there any way that can insert a current date after new_table?

Álvaro González
  • 142,137
  • 41
  • 261
  • 360

1 Answers1

1

Your problem is that the variable is not concatinated,

This should fix it

$query= 'CREATE TABLE new_table_'.$date.'AS SELECT * FROM old_table';