-3

Can anyone help me to fix the error I'm getting in my codes.

Issue: Parse error: syntax error, unexpected T_STRING in

The function of this script is to get Title and URL of all my Website Post and Save then in to a .CSV file. Right now I'm able to get full URL in the .CSV file, but the code is not getting the Title.

This is my code:

<?php
//Vital file include
require_once("load file");
include("Config File");


$useCategory=1; //0 for yes , 1 for no

$table='videos2_videos';
$fnamee='csvdata';
$list = array
(
"Title_-Url"
);


if($useCategory===1)
{
$data=mysql_query("SELECT * from $table where pub='1'");
}
else
{
$data=mysql_query("SELECT * from $table where pub='1' and categories='$category'");
}
while($adata=mysql_fetch_assoc($data))
{

        $url='http://www.domain.com/video/'.$adata['id'].'/';
        $Title= html_entity_decode(str_replace('&Aacute;','A',
        str_replace('&Eacut;e','E',
        str_replace('&Iacute;','I',
        str_replace('&Oacute;','O',
        str_replace('&Ntilde;','N',
        str_replace('&Ñtilde;','Ñ'
        str_replace('&Uacute;','U',
        str_replace('&Uuml;','U',
        str_replace('&iexcl;','!',
        str_replace('&iquest;','?',
        str_replace('&aacute;','a',
        str_replace('&eacute;','e',
        str_replace('&iacute;','i',
        str_replace('&oacute;','o',
        str_replace('&ntilde;','n',
        str_replace('&uacute;','u',
        str_replace('&uuml;','u',
        str_replace('&ordf;','a',
        str_replace('&ordm;','o',$adata['title'])))))))))))))))))),ENT_QUOTES,"ISO-8859-1");        


$list[].=$title.'_-'.$url;
}
$file = fopen("$fnamee.csv","w");

foreach ($list as $line)
  {
  fputcsv($file,explode('_-',$line),',');
  }

fclose($file); 
?>
<a href="csvdata.csv">Right click and save</a>

1 Answers1

1

Please remove your...ehm...code bellow $url and replace with this one:

$search = array(
    '&Aacute;', '&Eacut;e', '&Iacute;', '&Oacute;', '&Ntilde;', '&Ñtilde;', '&Uacute;', '&Uuml;', '&iexcl;', '&iquest;',
    '&aacute;', '&eacute;', '&iacute;', '&oacute;', '&ntilde;', '&uacute;', '&uuml;', '&ordf;', '&ordm;'
);
$replace = array('A', 'E', 'I', 'O', 'N', 'Ñ', 'U', 'U', '!', '?', 'a', 'e', 'i', 'o', 'n', 'u', 'u', 'a', 'o');

$title = html_entity_decode(str_replace($search, $replace, $adata['title']), ENT_QUOTES, "ISO-8859-1");
Zemistr
  • 1,049
  • 7
  • 10