|
|
These forums are to discuss any RSjoomla! related questions. Please note that official support is offered via Customer Support Ticketing System only, responses in the forum are not guaranteed.
how to fetch data from db (1 viewing)
|
|
TOPIC: how to fetch data from db
|
ramchandev (User)
Fresh Boarder
Posts: 10
|
| how to fetch data from db 2008/08/28 20:18 |
Karma: 0   |
|
Hi!
I am working on Rsformpro, i really like how RSformPRO works but i need a script to complete my form, i want to pull data from a table and fill all the fields with the data when the form loads. I have gone through the forum and the user guide but code listed there is not working for me. if this is not possible can you please say how we can identify the field name and its value when the form loads.
what i tried is this
foreach($fields as $i=>$field){ if($field->name=='selection')//where selection is the filed name{ $fields[$i]->default_value ='empty'; } }
it is not working for me. please help me with this, it will really make me vwry happy if your suggestion works.
eagerly waiting for your replay Ramchandran S
|
|
|
|
The administrator has disabled public write access. |
ian.scott (User)
Fresh Boarder
Posts: 1
|
| Re:how to fetch data from db 2008/09/28 00:21 |
Karma: 0   |
|
Found this on this forum
//<code> global $database, $my;//global declaration $mydata = $my->id;//fetching the user id who has logged in if($mydata!=0) { $data = mysql_query("SELECT * FROM jos_comprofiler WHERE id = '".$my->id."' ") or die(mysql_error());//this query will fetch you the record of that particular user while($info = mysql_fetch_array( $data )) { return $info['firstname'];//return the name of the user which will be populated in the text filed } } else { return 'no record'; } //</code>
This is put into the Default Value for every field you want prefilled - the example abve I'm taking the firstname from community builders fields
|
|
|
|
The administrator has disabled public write access. |
ramchandev (User)
Fresh Boarder
Posts: 10
|
| Re:how to fetch data from db 2008/09/29 07:16 |
Karma: 0   |
|
|
|
|
|
The administrator has disabled public write access. |
|
|
|
|
|