i've the next code to construct my variable:
$idProvincia=$_GET["ciudad"];
The table name will change according to the $idProvincia value. Table name:
$post="wp_".$idProvincia."_post";
and i want to include the $post variable into the query:
$result = mysql_query ("SELECT post.ID, post.post_title, post.guid, post.post_content, postmeta.meta_value, postmeta.meta_key
FROM `".$post."` AS post
INNER JOIN wp_".$idProvincia."_postmeta AS postmeta ON post.ID = postmeta.post_id
WHERE postmeta.meta_key='fc_start_datetime' AND post.post_status='publish' AND post.post_type='post'
ORDER BY postmeta.meta_value ") or die (mysql_error());
I can't get the correct result. I've read a lot of manuales but i can't get the query functional.
I want to do the same query procedure for more variables