Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Parse error: syntax error

$
0
0

Hello,
I am sitting on it for about an hour,two three and I just don't understand why I get this error ...
I am trying to create a new file with PHP and it gives me this error :
 

Parse error: syntax error, unexpected ']', expecting T_STRING or T_VARIABLE or T_NUM_STRING in admin.php on line 24

now,the problem is that this is line 24 :

\n$text[] = $row[0];

Around it/code :
function addPage() {
var page_name=prompt("Enter name");
if (page_name!=null) {
<?php
$file = fopen($_GET["page_name"].".php","w");
$fcontent = "\n$query = 'SELECT title FROM home';
\nif($result = mysqli_query($link,$query)) {
\n$pages = mysqli_num_rows($result);
\nwhile($row=mysqli_fetch_row($result)) {
\n$text[] = $row[0];
\n}
\nmysqli_free_result($result);
\n}";
fwrite($file,$fcontent);
fclose($file);
?>
}
}

Will appericiate if somebody will tell me what's wrong in here.
 
Greetings,
KubeR.

Viewing all articles
Browse latest Browse all 13200

Trending Articles