一直在处理这个问题一段时间,我无法弄清楚。 我已经读过类似的主题,但我一直无法反正。非法字符串偏移sqlite
我想从一个sqlite数据库使用php导入数据。我将使用这些数据来绘制它。每当我尝试运行代码时,我都被卡在“非法字符串偏移量”处。
下面是代码:
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
SELECT voltage from stuffToPlot;
EOF;
$voltage = array();
$ret = $db->query($sql);
while ($row = $ret->fetchArray(SQLITE3_NUM)) {
$voltage[] = row['voltage'];
//var_dump($row);
}
$graph = new Graph(300,250);
$graph->SetScale("textlin");
$theme_class=new UniversalTheme;
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Filled Y-grid');
$graph->SetBox(false);
$graph->img->SetAntiAliasing();
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->xgrid->SetColor('#E3E3E3');
$p1 = new LinePlot($voltage);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Line 1');
?>
?>
当我转储数据我得到这个响应Picturehttp://www.ladda-upp.se/bilder/zltczhawdxetj
日Thnx了很多!
错误应该告诉你 – nogad
'行[ '电压']什么线;'应该是'$行[ '电压'];'你离开了'$'。 – Barmar