How to access the result from a db read in "on success"

FreeSandwiches 10 Nov, 2014
Hi there. I am performing a db query based on matching the "userinputfindabook" field with columns of a form like this

<?php

if($form->data("searchby")==0){
return array("bookname" => $form->data("userinputfindabook"));
}
else if($form->data("searchby")==1){
return array("Author" => $form->data("userinputfindabook"));
}
else if($form->data("searchby")==2){
return array("ISBN" => $form->data("userinputfindabook"));
}
?>


I now want to create a new div for each result, but don't know how to access the result from the querry in the "On Found" area.

I am currently trying to do this

$result = mysql_query("SELECT Author FROM $form WHERE  ("userinputfindabook")");

while ($row = mysql_fetch_array($result)) {
 printf("ID: %s  Name: %s", $row[0], $row[1]); 
}


but I feel like I should be able to access the results from the db read and not have to do a seperate search.

Thanks in advance for your help. Cheers!
Max_admin 11 Nov, 2014
Hi,

If you are using the "db read" then why do you need the 2nd piece of code ? the results should be available under $form->data["Model_id"], it will be an array if the "multi" setting is enabled in the "db read".

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.