In a form I enter a query
dynamic (sql statement), which I will later use to make a query to multiple connections and then make a insert select
, the problem I have is that I don't know what is the name of the table to which I am going to do the insert , in such a way that my problem lies in how I get the name of the table after the FROM query
I would appreciate the interest.
To do that you can use "strstr()" to search for the word "from" and everything after it.
Then you can do an explode to divide the string by spaces and the word that follows it will be the name of the table.
This will result in:
One of the ways that occurred to me was to convert the
query(que es un string)
into aarray
and remove the FROM position to obtain the name of the table, since it will always be after the FROMBut if there is a much shorter solution, it is a great help.