I'm trying to assign the return value of a php script to a js variable. I have this:
var email = jQuery("input[name=email]").val();
var emailRegex = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,})?$/;
var exists='<?php
$query = "SELECT * FROM rss_members WHERE email_id=\"something@email\"";
$results = mysql_query($query);
$results = mysql_num_rows($results);
echo $results;
?>';
console.log(exists)
The query works and I get the correct results back, but I want to replace "something@email.com" with the email variable, but if I write something like email_id=\"'+email+'\"..., the query result comes back incorrect. What am I doing wrong?