Jump to content

trying to move a data import script from one website to another.


twkhub

Recommended Posts

There is a data feed being imported on a old website that I and trying to move the code from one domain name to another. When i copy all the files to the new site ftp and try and createCatagories.php when i try and run this on the new site i get this error:

 

Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /hsphere/local/home/tweekclo/tweekclothing.com/store/Skatefeed/createCategories.php on line 34

 

Heres the createcatagories.php code

<?php

ini_set("display_errors", "On"); //activeer de display_error

require_once('items/category.php');

 

emptyDBs();

 

$topCatIds = createTopCats();

createSubCats($topCatIds);

 

function emptyDBs(){

require_once('db.php');

mysql_query("delete from `categories_description` where 1 = 1");

mysql_query("delete from `categories` where 1 = 1");

}

 

function createTopCats(){

$topCatIds = array();

 

addTopCategory(&$topCatIds, '1D', 'Decks');

addTopCategory(&$topCatIds, '1W', 'Wheels');

addTopCategory(&$topCatIds, '1C', 'Completes');

addTopCategory(&$topCatIds, '1T', 'Trucks');

addTopCategory(&$topCatIds, '', 'Accessoires');

addTopCategory(&$topCatIds, '', 'Protective Gear');

addTopCategory(&$topCatIds, '', 'Clothing');

addTopCategory(&$topCatIds, '', 'Media');

addTopCategory(&$topCatIds, '', 'Snow');

 

return $topCatIds;

}

 

function createSubCats($topCatIds){

$catArray = file('subcats.txt', FILE_IGNORE_NEW_LINES);

foreach ($catArray as $key => &$cat) {

$arr = explode("\t", $cat);

$topCatId = $topCatIds[trim($arr[2])];

addCategory(trim($arr[0]), trim($arr[1]), $topCatId);

}

}

 

 

function addTopCategory($topCatIds, $ess_id, $name){

$cat = new Category($ess_id, $name);

$id = $cat->persist();

$topCatIds[$name] = $id;

}

 

function addCategory($ess_id, $name, $parentId){

if($ess_id != '' && $name != ''){

$cat = new Category($ess_id, $name, $parentId);

$cat->persist();

}

}

?>

Different versions of PHP on the two servers

 

Change each function call that passes values by reference from

addTopCategory(&$topCatIds, '1D', 'Decks');

to

addTopCategory($topCatIds, '1D', 'Decks');

and change

function addTopCategory($topCatIds, $ess_id, $name){

to

function addTopCategory(&$topCatIds, $ess_id, $name){

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.