I have mysql query:
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$formId = 21;
$query = "select * from #__rsform_submission_values WHERE `FormId` = $formId order by `SubmissionId` desc limit 30";
$db->setQuery($query);
$results = $db->loadObjectList();
It loads specific data from above table (see screenshot)
what I want is to load data like:
0 =>
object(stdClass)[427]
public 'SubmissionValueId' => string '20006' (length=5)
public 'FormId' => string '21' (length=2)
public 'SubmissionId' => string '1122' (length=4)
public 'FieldName' => string 'session_date' (length=12)
public 'session_date' => string '17-03-2022 20:00' (length=16)
1 =>
object(stdClass)[426]
public 'SubmissionValueId' => string '20007' (length=5)
public 'FormId' => string '21' (length=2)
public 'SubmissionId' => string '1122' (length=4)
public 'FieldName' => string 'city' (length=4)
public 'city' => string 'Hørsholm Kommune' (length=17)
so instead of FielValue = example it should be called session_date = example (replace all FieldValue to WITH FieldNames)