Hi, i'm trying to develop this page but it seems to be a problem in the interaction between PHP and javascript. The deal is that the HTML and javascript codes are created dynamically by the PHP code and it is created properly as I've seem in the source code generated by de navigator (IE, chrome and Mozilla)... but they keep not working...
the PHP code tha generates de 'function call' in javascript is:
PHP Code:
//Faz a busca pelos dados na tabela do ano selecionado
$result = mysql_query("SELECT * FROM Ano" . $ano_tabela['Ano'] . " ORDER BY Placas ASC");
One thing. You have have a nested for loop both using the variable $i. So as soon as the second loops begins the first $i is reset to 1. The limit for the loop is a variable which will also not work. It good programming practice to use different variable names for counters in nested loops.
Typical practice for a database query is to use a while loop. Mainly because unless you use function mysql_num_rows you won't know where to set the limit for the for loop.
Dasher, you are right about using the same variable, it was working because I was using $row = mysql_fetch_array($result) inside the first for loop... i've changed it alredy, but whatever, that wasn't the problem... testing the code again i've noticed that the function only works if I send numeric values to the javascript. For example, the function updateDiv(a,b,c,d) only would work if the values for a,b,c and d were numbers... I think that must be something related to variable type, but I can't imagine what it is...
please.. I really need this to work, because it's indispensable to send strings to the javascript function...
Bookmarks