Dynamic Links
Dynamic Links
Here's a problematic case
anybody have any idea how to implement links inside of the cells
here's my dillema
I pull information from mysql its the name of a bird "parrotX"
if I just wanted to display the name in the cell this would be fine
here is the code for that taken from the server_side_example.php
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$sOutput .= "[";
$sOutput .= "'".$aRow['birdLabel']."',"; //this works for displaying just the text inside the table cell
$sOutput .= "'".$aRow['birdName']."',";
$sOutput .= "'".$aRow['species']."',";
$sOutput .= "'".$aRow['family']."',";
$sOutput .= "'".$aRow['genus']."'";
$sOutput .= "],";
}
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= '] }';
[/code]
why does this not work
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$sOutput .= "[";
$sOutput .= "'"."",$aRow['birdName'],""."',";
$sOutput .= "'".$aRow['birdName']."',";
$sOutput .= "'".$aRow['species']."',";
$sOutput .= "'".$aRow['family']."',";
$sOutput .= "'".$aRow['genus']."'";
$sOutput .= "],";
}
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= '] }';
[/code]
Anybody done this before??
anybody have any idea how to implement links inside of the cells
here's my dillema
I pull information from mysql its the name of a bird "parrotX"
if I just wanted to display the name in the cell this would be fine
here is the code for that taken from the server_side_example.php
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$sOutput .= "[";
$sOutput .= "'".$aRow['birdLabel']."',"; //this works for displaying just the text inside the table cell
$sOutput .= "'".$aRow['birdName']."',";
$sOutput .= "'".$aRow['species']."',";
$sOutput .= "'".$aRow['family']."',";
$sOutput .= "'".$aRow['genus']."'";
$sOutput .= "],";
}
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= '] }';
[/code]
why does this not work
[code]
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$sOutput .= "[";
$sOutput .= "'"."",$aRow['birdName'],""."',";
$sOutput .= "'".$aRow['birdName']."',";
$sOutput .= "'".$aRow['species']."',";
$sOutput .= "'".$aRow['family']."',";
$sOutput .= "'".$aRow['genus']."'";
$sOutput .= "],";
}
$sOutput = substr_replace( $sOutput, "", -1 );
$sOutput .= '] }';
[/code]
Anybody done this before??
This discussion has been closed.
Replies
this will probably help someone else out in the future
in the script tags
[code]
"aoColumns": [
null,
{ "sType": "html" }
]
[/code]
but I am not sure where to put it since my code already looks like this
[code]
$(document).ready(function() {
$('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "search/server.php"
} );
} );
[/code]
[code]
$sOutput .= "'"."",$aRow['birdName'],""."',";
[/code]
1. You got commas rather than dots for the concatenation.
2. The HTML it produces is invalid (with single quotes in the HTML rather than double.
Regards,
Allan
$sOutput .= "'".$aRow['birdName']."',";
[/code]
try that,
as Allan said you had , instead of . for inserting rows record inside output:
[code]
$sOutput .= "'"."",$aRow['birdName'],""."',";
[/code]