Jump to content

Search the Community

Showing results for tags 'parse error: syntax error'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi all I'm new to programming and this forum and know very little about php. Any help would be greatly appreciated and I look forward to contributing and supporting others as my knowledge increases. I am trying to get a 'counter' php file working on my localhost. When I run the php file in chrome I get the following error: Parse error: syntax error, unexpected '$result' (T_VARIABLE), expecting ',' or ';' in C:\xampp\htdocs\database\counter.php on line 8 My php file contains the following: <?php require($_SERVER["DOCUMENT_ROOT"]."/database/config/db_config.php"); $connection = @mysql_connect($db_host,$db_user, $db_password) or die("error connecting"); mysql_select_db($db_name, $connection); $query = "SELECT * FROM counter"; echo $query $result = mysql_query($query, $connection) or die(mysql_error()); echo $result $views = mysql_result($result, 0, "num_views"); echo $views $views++; $query = "UPDATE counter SET num_views = $views"; mysql_query($query, $connection) or die(mysql_error()); echo "This page has been viewed ".$views." times."; ?> I created the counter table in phpmyadmin and it has the following details: # Name Type Collation Attributes Null Default Extra Action 1 num_views int(5) UNSIGNED No 0 Change Drop Browse distinct values Any help appreciated. Regards, Guy Brown counter.php
×
×
  • 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.