You can do that all in one line:
$query = "SELECT * FROM date_".mysql_real_escape_string ($_GET ["day"])
But… I don’t know if that’s going to get what you want. Do you really have a separate DB table for every day that you are going to query (in your example the table name is ‘date_130131’)? If so that sounds like it’s a really bad way to do it.
Also, look at what I’ve done, and take a lot of notice of the mysql_real_escape_string() function. You must use this any time you are going to use any SQL query that you are going to run. I cannot stress this enough. without it you are leaving yourself open to SQL injection and risk having your whole DB either compromised or wiped out.
Thread Starter
Attila
(@forexapi)
I know it is a strange solution, but my basic problem is the $day = $_GET[‘day’]; have a result if i call the PHP directly in the browser. But if I run the same program in Exec-PHP inside a WordPress based page it has no result. And I don’t know why?
Thread Starter
Attila
(@forexapi)
$day = date(ymd);
$date = (string)$day;
$query = “SELECT * FROM date_”.$date;
I found the answer. It was my fault. 🙂
Thanks!