This topic is locked
[SOLVED]

 Clickable Author

12/11/2014 8:44:17 AM
PHPRunner General questions
M
muhtar author

Hi,

One of my columns in my project is AuthorId. It contains numbers, and shows authors' names, using "Lookup Wizard" in my project.

What I wanted to do is that:

Authors' names should be clickable links. When users click these names, it returns a query: Author name equals its appropriate ID.

For example, 1 stands for Adam Smith at AuthorId in my project. Project shows it Adam Smith. User should be able to click this name, and the result will show all the books of Adam Smith.

Is this possible?

Sergey Kornilov admin 12/11/2014

Sure, you can use 'View as' type Custom for this purpose. Assuming that field name is AuthorId is both Authors and Books table here is the code you can use:

$value = "<a href=books_list.php?(AuthorId~equals~".$data["AuthorId"].")>Books by this author</a>";
M
muhtar author 12/12/2014



Sure, you can use 'View as' type Custom for this purpose. Assuming that field name is AuthorId is both Authors and Books table here is the code you can use:

$value = "<a href=books_list.php?(AuthorId~equals~".$data["AuthorId"].")>Books by this author</a>";



Dear Admin,

Thank you very much for your quick answer and help.

However, I could not run this code. After inserting this code, AuthorId begins to show "Books by this auhor" for all authors, and it does not filter the appropriate entries.

I would like to keep authors' names as long as they are clickable.
If I could run a code provided by you, I intend to use it for other columns such as series, tag etc.
I am not so good at databases, so may be I did something wrong.

A
Anapolis 12/13/2014

After inserting this code, AuthorId begins to show "Books by this auhor" for all authors, and it does not filter the appropriate entries.

I would like to keep authors' names as long as they are clickable.
If I could run a code provided by you, I intend to use it for other columns such as series, tag etc.
I am not so good at databases, so may be I did something wrong.


You are leaving out important information.
1rst question: I presume you have a table perhaps called 'titles' with row after row of book titles and in a different column called 'AuthorId' of this table you have the same number that is called "AuthorId" in the 'authors' table?
Do you have 2 tables that are related to each because they have a column called 'AuthorId'?

One table is all Author names and their assigned AuthorId number.

The other table is all those 'titles' with the AuthorId column filled with the same number, once in the Authors table, and multiple times in the 'titles' table.
So that when AuthorId 5 is selected that the query says something like "Select titles WHERE 'titles'.'AuthorId' = 5 SORT BY 'titles' " or maybe
"Select
titles WHERE AuthorId = '5' "

M
muhtar author 12/15/2014



You are leaving out important information.
1rst question: I presume you have a table perhaps called 'titles' with row after row of book titles and in a different column called 'AuthorId' of this table you have the same number that is called "AuthorId" in the 'authors' table?
Do you have 2 tables that are related to each because they have a column called 'AuthorId'?

One table is all Author names and their assigned AuthorId number.

The other table is all those 'titles' with the AuthorId column filled with the same number, once in the Authors table, and multiple times in the 'titles' table.
So that when AuthorId 5 is selected that the query says something like "Select titles WHERE 'titles'.'AuthorId' = 5 SORT BY 'titles' " or maybe
"Select
titles WHERE AuthorId = '5' "


Dear Maverick,
I have separate tables for each Id Columns. A table for Author, a table for series, a table for publication place, a table for publisher etc.
Let's make it simpler:
I would like to be able to click the name of an author, and the result will be like this:
..._list.php?q=(AuthorId~equals~AuthorId)
I would like to be able to click the series, and the result will be like this:

..._list.php?q=(Series~equals~SeriesId)

Sergey Kornilov admin 12/15/2014

But this exactly what code I provided does.