0

This code it work but put everything ("timestamp8","Last","TradePrice", ,"TradeFlags") into filname column How can I change it I want to put only "gel" into filname (inthis case $table = gel )

I try 'gel' it say Parse error: syntax error, unexpected 'gel' (T_STRING) in

Please suggest

$sql ='INSERT INTO pong8_maintable ("filname","timestamp8","Last","TradePrice", "TradeFlags"

) 

SELECT
"gel" ,
cast(public.'.$table.'."Timestamp" as timestamp) ,
cast(public.'.$table.'."Last" as numeric)  ,
cast(public.'.$table.'."Trade Flags"as varchar)


FROM Public.'.$table; 


sc_exec_sql($sql);
tee
  • 51
  • 1
  • 6

1 Answers1

0

I try this it work

SELECT
(\''.$table.'\') ,
cast(public.'.$table.'."Timestamp" as timestamp) ,
cast(public.'.$table.'."Last" as numeric)  ,
cast(public.'.$table.'."Trade Price" as numeric)  ,  

or

 SELECT
    (\'gel\') ,
    cast(public.'.$table.'."Timestamp" as timestamp) ,
    cast(public.'.$table.'."Last" as numeric)  ,
    cast(public.'.$table.'."Trade Price" as numeric)  ,  
tee
  • 51
  • 1
  • 6