By biosv on
Hope this is a right place to ask.
Here's the code I have a trouble with to display on the screen.
function name_searchform_submit($form, &$form_state) {
$sql = "SELECT * from {project}";
$resource = db_query($sql);
$results = array();
if ($resource) {
while($row = db_fetch_array($resource)) {
$results[] = $row;
}
}
$header = array_keys($results[0]);
$attrib = array('border' => 1);
$output = theme('table', $header, $results, $attrib);
print $output;
}
It works on my local Drupal installation. it displays the query result in table form.
But it does not work on our dev machine which is with a different theme. After clicking the submit button, it simply returns to the original query page without displaying anything. The theme was modified from some other theme by an ex developer who is gone now.
Is there any problem in the code?
Comments
Submit hooks (as in this
Submit hooks (as in this case) are meant to store data not display information. So you could use views for the search or look at the search module to see how it handles this.
Thanks for your
Thanks for your response.
That makes sense. I will look into it.
Simple Fix
Here' a simple fix I came up with, but I am not sure if it is a recommended way. Anyway, it works.