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();

}

}

?>

Link to comment
Share on other sites

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){

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.