>$query = "INSERT INTO `stats` (`vid`, `id`, `vn`, `time`, `host`, `referrer`, 
>`browser`) VALUES ('', '$id', '$_COOKIE
>['tececo_stats']', '$time', '$_SERVER['REMOTE_HOST']', '$_SERVER['HTTP_REFERER']', 
>'$_SERVER
>['HTTP_USER_AGENT']'); ";

Try using $_COOKIE[tececo_stats] instead...without the single quotes (for the other 
vars, too). 

You don't need all of those backticks in your query, either...

---John Holmes...
  ----- Original Message ----- 
  From: [EMAIL PROTECTED] 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, June 22, 2002 10:19 AM
  Subject: [PHP] Error(Newbie)


  Both the below are in the same dir.

  The meta.array_create.php file works fine elsewhere

  when I try and view stat.php I get this error:

  Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in 
C:\TecEco(Converting To PHP)\includes\stat.php on line 7

  What does the error mean and how can I correct my code?

  File meta.array_create.php
  -----------------------------------
  <?
    $fn = explode("/", $_SERVER['PHP_SELF']);
    $num_of_s = count($fn) - 1;
    $fn = "$fn[$num_of_s]";
    $query = "SELECT * FROM meta_data WHERE page_name = '$fn'";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);
    $row = mysql_fetch_array($result);
    $id = $row['id'];
    $pid = $row['pid'];
    $title = $row['title'];
    $description = $row['description'];
    $keywords = $row['keywords'];
  ?>

  file stat.php
  -------------------------

  <?
  include "meta.array_create.php";
  if(!isset($_COOKIE['tececo_stats']))
  {
  setcookie ("tececo_stats", 1);
  }
  $query = "INSERT INTO `stats` (`vid`, `id`, `vn`, `time`, `host`, `referrer`, 
`browser`) VALUES ('', '$id', '$_COOKIE['tececo_stats']', '$time', 
'$_SERVER['REMOTE_HOST']', '$_SERVER['HTTP_REFERER']', '$_SERVER['HTTP_USER_AGENT']'); 
";
  $insert = mysql_query($query);
  ?>


------------------------------------------------------------------------------


  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to