I have a query that I just can't seem to figure out.
I want to select links from the same category that link is in.
query = "select * from idx_link where category_id = (to same category that link is in) order by title";
I have a query that I just can't seem to figure out.
I want to select links from the same category that link is in.
query = "select * from idx_link where category_id = (to same category that link is in) order by title";
Code:$query = "SELECT * from idx_link where link_id = $link_id"; $result = $conn->Execute($query); $category_id = $result->Fields("category_id"); query = "select * from idx_link where category_id = $category_id order by title"; $result = $conn->Execute($query);
![]()
esm
"The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."
.
Fatal error: Call to a member function on a non-object on:
$category_id = $result->Fields("category_id");
I'm basically trying to insert this query into the detail.php page.
Where am I going wrong?
try changing $link_id to $linkid
![]()
Last edited by esm; 10-05-2004 at 07:20 PM.
esm
"The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."
.
its not the $linkid or $id which I have tried.
For some reason it get an error on that one important line
$category_id = $result->Fields("category_id"); which prevents me from isolating the category_id
why oh why...
When i put $category_id = 200; it works for category 200... but thats not what i want... boo
send me your detail.php file
![]()
esm
"The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."
.
OK. I fixed it.
$result1 = $conn->Execute($query);
$category_id = $result1->Fields("category_id");
All i had to do was place a 1 after the result...
Shouldn't something be pass to $result first before trying to extract something from it
here is the code to make it work:
Code:///hot links hack ****************** $hot_links_obj = new clsLink; $hot_links_obj->InitDB($dbServer,$dbHostname,$dbUsername,$dbPassword,$dbName); $hot_links_obj->table_name = "idx_link"; $hot_links_obj->category_table_name = "idx_category"; $hot_links_obj->max_rows = $main_hot_links; $queryh = "select * from idx_link where link_id = '$id'"; $resulth = $conn->Execute($queryh); $category_id = $resulth->Fields("category_id"); $hot_links_obj->queryh1 = "select * from idx_link where category_id = $category_id order by title"; $hot_links_obj->resulth1 = $conn->Execute($queryh1); $hot_links_obj->template = $msg["99999"]; $hot_links_obj->enable_cache = false; $hot_links = $hot_links_obj->Display(); ///hot links end **********************
![]()
esm
"The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."
.