RSjoomla! - Quality Joomla! Components

My Account






Lost Password?
No account yet? Register

Newsletter Subscribe

If you would like to be one of the first people to hear about the release of our new components then make sure you have subscribed to our announcements list! We won't bug you with unnecessary stuff.




RSjoomla! Board
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.
Welcome, Guest
Please Login or Register.
Lost Password?
how to fetch data from db (1 viewing)
_GEN_GOTOBOTTOM Post Reply

TOPIC: how to fetch data from db

#4507
ramchandev (User)
Fresh Boarder
Posts: 10
graphgraph
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.
#4866
ian.scott (User)
Fresh Boarder
Posts: 1
graphgraph
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.
#4890
ramchandev (User)
Fresh Boarder
Posts: 10
graphgraph
Re:how to fetch data from db 2008/09/29 07:16 Karma: 0  
Hi!

Try this

http://www.rsjoomla.com/index.php/RSform-Scripts/3808-Need-to-grab-Juser-fields-info-for-RS- Forms.html

to get the specific filed data...
still the if you have any problems let me know.
  The administrator has disabled public write access.
_GEN_GOTOTOP Post Reply
© Copyright 2007 Best of Joomla, Powered by FireBoardget the latest posts directly to your desktop