PDA

View Full Version : Query database ExtJs 4.2.1



Programmers
27 Feb 2014, 10:36 AM
hi Community,

I'm just a loop to form

the code provides the following dimensions from





Ext.Ajax.request({async:false, method:'POST', url:'demo.php', success:function(response){
if (response.responseText == 0) {return 0;}; var mydata = Ext.decode(response.responseText);
for (var i = 0; i <= 9; i++) {Ext.get('testId' + i).setHTML(mydata[0].name + i);};
}})



the code does not work but

one of you has an idea of how it might work


by programmers

scottmartin
27 Feb 2014, 7:26 PM
Can you elaborate on what is not working?
Are you not receiving any data?
Is your response valid?
Can you post your JSON so it can be tested?

Programmers
28 Feb 2014, 3:09 AM
Hi Scott,.

you don't get what I want to do.

to your questions

1. the JSON string is ok
2 I also clean get back the data

the field name of the database in the JSON string is my problem

the string looks like this




{datenbankfeld300..../* here my data */,
datenbankfeld301...../* here my data */,
datenbankfeld302..../* here my data */..,etc.}



now I would like to if the data is to be output do not always




Ext.get( /*' fornfield id '*/).setHTML(mnudata[0].datenbankfeld300);
Ext.get( /*' fornfield id '*/).setHTML(mnudata[0].datenbankfeld301);
Ext.get( /*' fornfield id '*/).setHTML(mnudata[0].datenbankfeld302);



etc. specify /* here the output is ok */

I would like to like this per for loop release

e.g. should then for mnudata [0]. datenbankfeld300 mnudata [0]. datenbankfeld30 + i used or something like
but then i replaced the last character of datenbankfeld300, 301, 302,

the loop would look like in this




for ( i = 0, i <= 2 ++i ) {Ext.get( /* ' here the formfield id ' */ ).setHTML(mnudata[0].datenbankfeld30+i);}



I hope you now understand what I mean

I've found the following

i is a number

and what is mnudata [0]. datenbankfeld300 for a format?


by programmers

Programmers
28 Feb 2014, 3:59 AM
I'm the json string as follows

where datenbankfeld300 now is regtxt00 etc.





while ($row = mysql_fetch_array($results, MYSQL_ASSOC)) {$tbRow[] = array(
'regtxt00' => $row['regtxt00'], 'regtxt01' => $row['regtxt01'],
'regtxt02' => $row['regtxt02'], 'regtxt03' => $row['regtxt03'],
'regtxt04' => $row['regtxt04'], 'regtxt05' => $row['regtxt05'],
'regtxt06' => $row['regtxt06'], 'regtxt07' => $row['regtxt07'],
'regtxt08' => $row['regtxt08'], 'regtxt09' => $row['regtxt09']);}

if (isset($tbRow) == 1) {echo json_encode($tbRow);}

Programmers
2 Mar 2014, 9:16 AM
It's alive