I keep getting the following syntax error: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in C:\xampp\xampp\htdocs\xampp\getFriends.php on line 26

I'm hoping some fresh eyeballs on this will help. I've been puzzling through it for the better part of the day and I'll be doggone if I can find the error...

17:// check for success or failure 18:if (empty($buffer)) { 19: echo 'Error'; 20:} else { 21: echo '<h1>Success Connate</h1><hr>'; 22:} 23: echo $buffer 24: 25:// copy buffer to a csv file 26:$list = ob_get_contents( ); 27: $fp = fopen(file.csv, x); 28:foreach ("$list" as $line) { 29: fputcsv($fp, split(',', $line)); 30:} 31: 32:?>[code=php]
17:// check for success or failure
18:if (empty($buffer)) {
19: echo 'Error';
20:} else {
21: echo '<h1>Success Connate</h1><hr>';
22:}
23: echo $buffer
24:
25:// copy buffer to a csv file
26:$list = ob_get_contents( );
27: $fp = fopen(file.csv, x);
28:foreach ("$list" as $line) {
29: fputcsv($fp, split(',', $line));
30:}
31:
32:?>

Recommended Answers

All 2 Replies

Member Avatar for Zagga

Hi rrothfeldt,

When you get this type of error, look at the few lines above the line mentioned.
In this case, you missed out a semicolon on line 23

23: echo $buffer;


Zagga

Hi rrothfeldt,

When you get this type of error, look at the few lines above the line mentioned.
In this case, you missed out a semicolon on line 23

23: echo $buffer;


Zagga

Thanks, Zagga! Yep, that fixed it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.