Jump to content


Photo

PHP CSV


  • Please log in to reply
No replies to this topic

#1 cyber-drugs

cyber-drugs
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 05 June 2005 - 09:32 AM

This file used to work, and then I changed something, and now it's messed...

I can't seem to find the problem.

ERROR:

Parse error: parse error, unexpected $ in /home/ourklub/public_html/Clients/Projects/2/3/Script/CSV.php on line 122



URL: http://www.cyber-lan.../Script/CSV.php

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]
[span style=\"color:#0000BB\"]<?php
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Connect to Database Function
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#007700\"]function [/span][span style=\"color:#0000BB\"]DatabaseConnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$location[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$username[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$password[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$database[/span][span style=\"color:#007700\"])
{
[/span][span style=\"color:#0000BB\"]$conn [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]mysql_connect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$location[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$username[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$password[/span][span style=\"color:#007700\"]);
if (&[/span][span style=\"color:#FF8000\"]#33;$conn) die (\"Could not connect MySQL\");
[/span][span style=\"color:#0000BB\"]mysql_select_db[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$database[/span][span style=\"color:#007700\"],[/span][span style=\"color:#0000BB\"]$conn[/span][span style=\"color:#007700\"]) or die ([/span][span style=\"color:#DD0000\"]\"Could not open database\"[/span][span style=\"color:#007700\"]);
}
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Connect to Database
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#0000BB\"]DatabaseConnect[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"localhost\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"****\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"****\"[/span][span style=\"color:#007700\"], [/span][span style=\"color:#DD0000\"]\"****\"[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]?>
[/span]<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<title>Cyber-Lane&trade;</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">
</head>

<body>
[span style=\"color:#0000BB\"]<?php
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Extract information from comma separated values
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#0000BB\"]$csv [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]file[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\"imi_gallery_database.csv\"[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]$count [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]count[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$csv[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Drop Table
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#DD0000\"]\"DROP TABLE `Imoderni_Gallery`\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Re-Create Table
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#DD0000\"]\"CREATE TABLE `Imoderni_Gallery` ( `ID` INT NOT NULL AUTO_INCREMENT\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$o [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"];
while ([/span][span style=\"color:#0000BB\"]$o [/span][span style=\"color:#007700\"]<= [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"])
{
[/span][span style=\"color:#0000BB\"]$info [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]explode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\',\'[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$csv[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]$o[/span][span style=\"color:#007700\"]]);
while ([/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]<= [/span][span style=\"color:#0000BB\"]33[/span][span style=\"color:#007700\"])
{
   [/span][span style=\"color:#0000BB\"]$sql [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\" , `\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]trim[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$info[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]$i[/span][span style=\"color:#007700\"]]).[/span][span style=\"color:#DD0000\"]\"` VARCHAR( 255 ) NOT NULL\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$i[/span][span style=\"color:#007700\"]++;
}
[/span][span style=\"color:#0000BB\"]$o[/span][span style=\"color:#007700\"]++;
}
[/span][span style=\"color:#0000BB\"]$sql [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\" , `Image` VARCHAR ( 255 ) NOT NULL , `CatA` VARCHAR ( 255 ) NOT NULL , `CatB` VARCHAR ( 255 ) NOT NULL , PRIMARY KEY ( `ID` ));\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#FF8000\"]//----------------------------------------------------------------------------------------------------------
// Insert Data into Table
//----------------------------------------------------------------------------------------------------------
[/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$o [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]1[/span][span style=\"color:#007700\"];
while ([/span][span style=\"color:#0000BB\"]$o [/span][span style=\"color:#007700\"]<= [/span][span style=\"color:#0000BB\"]$count[/span][span style=\"color:#007700\"])
{
[/span][span style=\"color:#0000BB\"]$info [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]explode[/span][span style=\"color:#007700\"]([/span][span style=\"color:#DD0000\"]\',\'[/span][span style=\"color:#007700\"], [/span][span style=\"color:#0000BB\"]$csv[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]$o[/span][span style=\"color:#007700\"]]);
while ([/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]<= [/span][span style=\"color:#0000BB\"]33[/span][span style=\"color:#007700\"])
{
[/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]=[/span][span style=\"color:#DD0000\"]\"INSERT INTO `Imoderni_Gallery` (
        `ID` ,
        `Information_ProductCode` ,
        `Information_ProductName` ,
        `Manufacturer` ,
        `Cat_Ref` ,
        `Information_ProductDescription` ,
        `Finish_Material` ,
        `Information_Size` ,
        `Information_Color` ,
        `Information_Pattern` ,
        `Information_Border` ,
        `Features` ,
        `Information_Wear` ,
        `Note` ,
        `Designer` ,
        `Category` ,
        `Information_SubCat1` ,
        `Information_SubCat2` ,
        `Information_SimilarProducts` ,
        `Information_Weblinks` ,
        `Information_Weblinks2` ,
        `Dealer_note` ,
        `MSRP_EUPrice` ,
        `MSRP_DealerDiscount` ,
        `MSRP_DealerPrice` ,
        `MSRP_RetailMarkup` ,
        `MSRP_SubTotal` ,
        `MSRP_Currency` ,
        `MSRP_CurrencyMultiplier` ,
        `Sold_as` ,
        `Number_In_Set` ,
        `MSRP_SoldIndividually` ,
        `MSRP_Total` ,
        `MSRP_exchange` )
      VALUES ( \"[/span][span style=\"color:#007700\"];
  [/span][span style=\"color:#0000BB\"]$r [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"];
  while ([/span][span style=\"color:#0000BB\"]$r [/span][span style=\"color:#007700\"]<= [/span][span style=\"color:#0000BB\"]33[/span][span style=\"color:#007700\"])
  {
    if ([/span][span style=\"color:#0000BB\"]$r [/span][span style=\"color:#007700\"]== [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"])
    {
      [/span][span style=\"color:#0000BB\"]$sql [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\"\'\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$info[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]$r[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"\'\"[/span][span style=\"color:#007700\"];
    } else {
      [/span][span style=\"color:#0000BB\"]$sql [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\", \'\"[/span][span style=\"color:#007700\"].[/span][span style=\"color:#0000BB\"]$info[/span][span style=\"color:#007700\"][[/span][span style=\"color:#0000BB\"]$r[/span][span style=\"color:#007700\"]].[/span][span style=\"color:#DD0000\"]\"\'\"[/span][span style=\"color:#007700\"];
    }
[/span][span style=\"color:#0000BB\"]$r[/span][span style=\"color:#007700\"]++;
  }
  [/span][span style=\"color:#0000BB\"]$i[/span][span style=\"color:#007700\"]++;
}
[/span][span style=\"color:#0000BB\"]$i [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]0[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#0000BB\"]$sql [/span][span style=\"color:#007700\"]= [/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"].[/span][span style=\"color:#DD0000\"]\" );\"[/span][span style=\"color:#007700\"];
[/span][span style=\"color:#FF8000\"]// echo(\"<strong>\".$sql.\"</strong><br><br><br>\");
[/span][span style=\"color:#0000BB\"]mysql_query[/span][span style=\"color:#007700\"]([/span][span style=\"color:#0000BB\"]$sql[/span][span style=\"color:#007700\"]);
[/span][span style=\"color:#0000BB\"]$o[/span][span style=\"color:#007700\"]++;
}
[/span][span style=\"color:#0000BB\"]?>
[/span]</body>
</html>[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Anyone able to help me out here with fixing this please?

Cheers.

[EDIT]
I was looking at the wrong code, so there was no problem...
[/EDIT]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users