3.2.0

get an error if without trim()

i newbie in this TM.
i think it's better to add trim() to the $value to free from whitespace.
because i found error if i don't do that (my data in MySQl start/end with whitespace).
i Add this trim() like this:
foreach ($record as $value){
$value=trim($value);
echo $cellSeparator."\"".$value."\"";
$cellSeparator = ",";
}

function from alex:
function aw_cells($dataset){

$recordSeparator = "";
echo "[\n";

while ($record = @mysql_fetch_array($dataset)) {

echo $recordSeparator;
$cellSeparator = "";
echo "\t[";
foreach ($record as $value){
echo $cellSeparator."\"".$value."\"";
$cellSeparator = ",";
}
echo "]";
$recordSeparator = ",\n";
}

echo "\n];\n";
}
winotosw
April 15,

This topic is archived.

See also:


Back to support forum