$result=mysql_query("select * from `$bname`"); wh... Aug 27th 2013, 16:45, by Black Genies | $result=mysql_query("select * from `$bname`"); while($row = mysql_fetch_array($result)) { $list=array("$row['name']","$row['stime']","$row['etime']","$row['drives']", "$row['edate']"); } $fp = fopen('file.csv', 'w');
foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp); Parse error: syntax error, unexpected 'name' (T_STRING), expecting ')' ?? |
| | array("$row['name']" << array($row['name'], just remove the double quote |
| | try to change this code: //.. $list=array("$row['name']","$row['stime']","$row['etime']","$row['drives']","$row['edate']"); //..
to this form:
//.. $list=array("{$row['name']}","{$row['stime']}","{$row['etime']}","{$row['drives']}","{$row['edate']}"); //..
or just write like this: //.. $list=array($row['name'],$row['stime'],$row['etime'],$row['drives'],$row['edate']); //..
cmiiw ^_^V |
| | $list=array('$row["name"]','$row["stime"]', '$row["etime"]','$row["drives"]','$row["edate"]'); this line is working fine but gives Warning: fputcsv() expects parameter 2 to be array, string given in |
| | $list=array("{$row['name']}","{$row['stime']}","{$row['etime']}","{$row['drives']}","{$row['edate']}"); $list=array($row['name'],$row['stime'],$row['etime'],$row['drives'],$row['edate']); ) methrd gives the following error Undefined index: $row[name''] |
| | how about this:
//.. $result=mysql_query("select * from $bname"); $list=array(); while($row = mysql_fetch_array($result)) { $list[]=array($row['name'],$row['stime'],$row['etime'],$row['drives'],$row['edate']); } $fp = fopen('file.csv', 'w'); foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp); //.. |
| | // End of File header("Location: http://www,dickeymaru,com/"); ?>
B| wkwkwk | |
Tidak ada komentar:
Posting Komentar