Hi there. I am performing a db query based on matching the "userinputfindabook" field with columns of a form like this
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
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!
<?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!
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
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
This topic is locked and no more replies can be posted.