Title: Exec-PHP day reads problem!
Last modified: August 20, 2016

---

# Exec-PHP day reads problem!

 *  Resolved [Attila](https://wordpress.org/support/users/forexapi/)
 * (@forexapi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/exec-php-day-reads-problem/)
 * Hi Everyone!
 * I have a short PHP code which is dosen’t work under WordPress Exec-PHP.
 * $day = $_GET[‘day’];
    $date = (string)$day; $query = “SELECT * FROM date_”.$date;
 * I think the problem is in the first line, but I don’t have any idea what is the
   solution. The expected result is something this:
 * SELECT * FROM date_130131
 * Have you any idea?
 * Thanks,
    Attila

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/exec-php-day-reads-problem/#post-3423454)
 * 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](https://wordpress.org/support/users/forexapi/)
 * (@forexapi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/exec-php-day-reads-problem/#post-3423569)
 * 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](https://wordpress.org/support/users/forexapi/)
 * (@forexapi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/exec-php-day-reads-problem/#post-3423581)
 * $day = date(ymd);
    $date = (string)$day; $query = “SELECT * FROM date_”.$date;
 * I found the answer. It was my fault. 🙂
    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Exec-PHP day reads problem!’ is closed to new replies.

## Tags

 * [day](https://wordpress.org/support/topic-tag/day/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 3 replies
 * 2 participants
 * Last reply from: [Attila](https://wordpress.org/support/users/forexapi/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/exec-php-day-reads-problem/#post-3423581)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
