• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Populate Fields to Update Record

Populate Fields to Update Record 12 years 6 months ago #19138

  • andrew.rapp
  • andrew.rapp's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Thank you received: 2
Hello,

I've created a form that inserts rows into a table in the database. Now I want to create a second form that allows users to update that row. I'd like the second form auto-populate with the entries already in the database. I followed the instructions on some similar threads here, but can't get it to work. I think my sql syntax is wrong. For each field, I'm entering the following as the default value:

//<code>
$user =& JFactory::getUser();
$usrid = $user->get('id');
$db =& JFactory::getDBO();
{
$db->setQuery("SELECT 'paypalid' FROM 'ketfx_iendorse_userprofile' WHERE 'uid'=$usrid");
$paypalid = $db->loadResult();
}
return $paypalid;
//</code>

If I understand it correctly, this should get the user id of the currently logged in user, then query my table for the field 'paypalid' when the record has a matching user id (uid is the primary key in the table). That value should be entered as the default value when the form is rendered. However, I seem to either get a blank field, or an error.

Can someone tell me if there is an error in my syntax?

Thanks!
The administrator has disabled public write access.

Populate Fields to Update Record 12 years 5 months ago #19988

Hi,

I am trying to do the same but I can't locate the place where I have to paste my own code, did you manage to make it working ? thanks in advance

Michel
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!