Hello,
I have a snippet of javascript which is pulling a cookie file and translating the variable "myuser" into the currently logged in value (shown below)...
var myuser = readcookie('user');
This is working successfully and I can write it to a page. But this isn't quite enough because I'm trying to compare that value (someone's username) to a MySQL database field which stores a picture number such as 45625.jpg and attempting to write that to a page so I can use a include file command at the end of an img src html command to display that particular users thumbnail picture. How I haven't lost you yet
What I'm trying to do now is send this variable to a php query. I have already successfully sent it to a php variable, and can verify this by using echo with the newly created php variable, $newvar, which interpreted the javascript variable from document.write as myuser.
$newvar = "<script language=JavaScript> document.write(myuser);</script>";
$query = "SELECT picture FROM community_users WHERE user='$newvar'";
$result = mysql_query($query)
or die("Query failed");
The problem is in the actual query... the $newvar never parses as anything. Yet if I write it out with an echo such as:
echo $newvar;
... it works fine.
What method do I have to use to have this variable be interpreted before php attempts to process on the server-side?
Thanks for any help!