wp_title as SQL variable
-
Hi, this is probably a really dumb question but I’m pretty new to all this and just can’t work it out. I have created this code.
$my_title = wp_title('', false); $data = mysql_query("SELECT * FROM wp_posts WHERE post_title='$my_title' AND post_mime_type='image/jpeg'") or die(mysql_error());
Basically it’s to tell a carousel to pull images whose names match the title of the page from a database. When I echo the “$my_title” variable it works and when I substitue “wp_title(”, false);” for a single word like ‘products’ it also works so I’m quite confused. Is it something to do with Global variables (that’s my stab in the dark)?
Thanks for your help in advance!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘wp_title as SQL variable’ is closed to new replies.