• 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: FAST WAY TO CREATE A VARIABLE FROM EVERY DB COLUMN

FAST WAY TO CREATE A VARIABLE FROM EVERY DB COLUMN 12 years 3 months ago #15917

  • learnthrusong
  • learnthrusong's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 26
  • Thank you received: 3
If you're using RS FORM PRO to customise your own tables OR component tables, using this script will give you a list of all columns (field names) and then append " = $" followed by the column name again.
SELECT CONCAT( column_name,  ' = $', column_name ) 
FROM information_schema.columns
WHERE table_name =  'your_table_name'
This means that if you have a massive table and you want to grab all of the cols into an INSERT or UPDATE script, you can easily manipulate the $var names to match your form fields.

Example
1 - You have a table called clients
2 - You fields called - id, addr1, addr2, tel, billing_tel, billing_email and so on...

If you run the above script, either in PHPMyAdmin or in your form's script area, you would return an array like;
id = $id
addr1 = $addr1
addr2 = $addr2
tel = $tel
billing_tel = $billing_tel
billing_email = $billing_email
Hope someone finds this useful!

Gez
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!