I perform a mysql query SELECT * FROM table
WHERE mp3link = '$songname' I want the variable $songname to = a jquery variable named 'key' which changes depending on the song playing. So far everything works when i set $songname ='illuminati.mp3' it will fetch and echo 'Illuminati' in the text. but when I try to exit the php and fetch the jquery variable it wont work. I was reading that PHP is server side and Jquery is client side so this may be why? but then I heard about a language called AJAX that may be able to do this?
$(".blocksong").on('click', function () {
var key = $(this).attr('key');
EvalSound(this, key);
var this_play = $(this);
$(".blocksong").each(function () {
if ($(this)[0] != this_play[0]) {
$(this).removeClass("blockpause");
}
});
$(this).toggleClass("blockpause");
$(".nowplaying").text("<?php
$songname = " key "; // how do I insert var key here?
$nowplay=mysql_fetch_assoc(mysql_query("SELECT * FROM `soundplum` WHERE mp3link = '$songname'"));
echo $nowplay['name'];
?>");