Hi,
I tried to use dynamic table names like:

create table outgoing_%Y%m%d (                                                                                                                                            
   ip_src CHAR(15) NOT NULL,                                                                                                                                                             
   ip_dst CHAR(15) NOT NULL,                                                                                                                                                             
   src_port INT(2) UNSIGNED NOT NULL,                                                                                                                                                    
   dst_port INT(2) UNSIGNED NOT NULL,                                                                                                                                                    
   stamp DATETIME,                                                                                                                                                               
   PRIMARY KEY (ip_src, ip_dst, src_port, dst_port, stamp_inserted)                                           
);

but every time i got message about syntax error:

error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%Y%m%d (' at line 1

So, I'm even not sure, it is possible to use %Y%m%d in name or not?
Cheers,
flybro

What do you mean by dynamic table names

The %Y%m%d are formatting instructions used INSIDE the date_format() function. Outside that function they are probably totally meaningless. They are probably being interpreted literally and may not be valid characters to include in a table name, unless the entire name was quoted, which would then cause you problems of having to use quotes in evvery query of that table name.

So if you are expecting the table name to turn into outgoing_20010-03-28 you will have to find another way to get this name.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.