Help With Using Links
Help With Using Links
Hello everyone,
I am using server-side processing (getting data from mysql database) for my DataTables. I am trying to make one column a click-able link. I will explain below more about what I am trying to achieve.
My mysql database contains a table called "offers". Within that table are the following fields.
- id
- name
- url
- reward
- countries
- type
Right now I only grab & display the data from the 'name','reward','country', and 'type' fields.
Seen Here (http://vinefeedr.calendarr.net/offers2.php)
What I want to do, is to make each 'name' field attain the respected 'url' link, making it click-able once outputted.
Please help as I am really looking forward to getting this to work.
My Current "server_processing.php" Code.
http://pastebin.com/gVKvWG7j
My Current Initialization Code.
http://pastebin.com/Q4BcYuzC
It you need more information, please reply as well.
I am using server-side processing (getting data from mysql database) for my DataTables. I am trying to make one column a click-able link. I will explain below more about what I am trying to achieve.
My mysql database contains a table called "offers". Within that table are the following fields.
- id
- name
- url
- reward
- countries
- type
Right now I only grab & display the data from the 'name','reward','country', and 'type' fields.
Seen Here (http://vinefeedr.calendarr.net/offers2.php)
What I want to do, is to make each 'name' field attain the respected 'url' link, making it click-able once outputted.
Please help as I am really looking forward to getting this to work.
My Current "server_processing.php" Code.
http://pastebin.com/gVKvWG7j
My Current Initialization Code.
http://pastebin.com/Q4BcYuzC
It you need more information, please reply as well.
This discussion has been closed.
Replies
If it helps, my request is similar to this one.
http://datatables.net/forums/comments.php?DiscussionID=2797&page=1#Item_0
Why don't you add the 'url' field into your request and then simply work with it in your PHP code? Is it difficult to you to wrap 'name' into anchor HTML-tag?
How do you work with retrieved data before you output them?
Doesn't this code work properly?
[code]
...
$aColumns = array( 'name','url', 'reward', 'countries', 'type', 'visits');
...
if ( $aColumns[$i] === "url" ) continue
elseif ( $aColumns[$i] === "version" )
{
/* Special output formatting for 'version' column */
$row[] = ($aRow[ $aColumns[$i] ]==="0") ? '-' : $aRow[ $aColumns[$i] ];
}
elseif ( $aColumns[$i] === "name" )
{
/* Special output formatting for 'name' column */
$row[] = ''. $aRow[ $aColumns[$i] ]. '';
}
elseif ( $aColumns[$i] !== ' ' )
{
/* General output */
$row[] = $aRow[ $aColumns[$i] ];
}
...
[/code]