Javascript/PHP/MySQL quoting problem?

Trombone

New member
For some reason, this:
(begin code)

function changeYear(){
// var userInput = document.getElementById('year_id').value;
userInput = "2009";
var new_in = "<?
$result_agenda = mysql_query('SELECT * FROM gbminutes WHERE type = 1 AND year(date) = " + userInput + " ');

while ( $row = mysql_fetch_array($result_agenda) ) {
echo ('<li>'.$row['date'].'</li>');
}

?>";
document.getElementById('minutes_list').innerHTML = new_in;
}

(end code)

produces this SQL statement:

SELECT * FROM gbminutes WHERE type = 1 AND year(date) = " + userInput + "

Obviously its a quoting thing but its killing me. I've tried everything. Any ideas?
 
Back
Top