Server Side Columns
Server Side Columns
I'm using a server side database (mySQL), and when constructing the JSON array I have some data that is created without having an actual column in the table, ie:
[code]
$sOutput .= '"aaData": [ ';
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$rating = get_current_rating($aRow['id'],1);
$sOutput .= "[";
$sOutput .= '"'.addslashes("".$rating."").'",';
$sOutput .= '"'.addslashes("".truncate ($aRow['title'], 35)."").'",';
$sOutput .= '"'.addslashes(truncate ($aRow['description'], 80)).'",';
$sOutput .= '"'.addslashes($aRow['views']).'",';
$sOutput .= '"'.addslashes("".date ( 'M d, Y', $aRow['date']) ).'"';
$sOutput .= "],";
}
[/code]
The JSON fails because "Added data does not match the number of columns"
Any suggestions on how to fix?
[code]
$sOutput .= '"aaData": [ ';
while ( $aRow = mysql_fetch_array( $rResult ) )
{
$rating = get_current_rating($aRow['id'],1);
$sOutput .= "[";
$sOutput .= '"'.addslashes("".$rating."").'",';
$sOutput .= '"'.addslashes("".truncate ($aRow['title'], 35)."").'",';
$sOutput .= '"'.addslashes(truncate ($aRow['description'], 80)).'",';
$sOutput .= '"'.addslashes($aRow['views']).'",';
$sOutput .= '"'.addslashes("".date ( 'M d, Y', $aRow['date']) ).'"';
$sOutput .= "],";
}
[/code]
The JSON fails because "Added data does not match the number of columns"
Any suggestions on how to fix?
This discussion has been closed.
Replies