Server Side Columns

Server Side Columns

brousapgbrousapg Posts: 6Questions: 0Answers: 0
edited August 2010 in General
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?

Replies

  • brousapgbrousapg Posts: 6Questions: 0Answers: 0
    This also unfortunately breaks the sorting (not having a column to ORDER BY). I was thinking a view could possibly fix?
  • brousapgbrousapg Posts: 6Questions: 0Answers: 0
    Yep, created a view fixed it.
This discussion has been closed.