Jump to content

Search the Community

Showing results for tags 'php pdo database'.

  • 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. I seem to be having an issue with this script. Im pretty sure its in my if statement but i cant figure out what is wrong. Any one see anything obviously wrong ? $ip_address = $_SERVER['REMOTE_ADDR']; $user_name = $_SESSION['user_name']; $url = $_SERVER['REQUEST_URI']; $tokens = explode('/', $url); $image_id = $tokens[sizeof($tokens)-1]; //Connect to the database include 'db_connect.php'; $sql_1 = "SELECT * FROM tracking_table"; $statement = $db->prepare($sql_1); $statement->execute(array()); while($row = $statement->fetch(PDO::FETCH_ASSOC)) { $compare_id = $row['image_id']; $count = $row['count']; } if ($compare_id != $image_id) { $sql_2 = "INSERT INTO tracking_table (image_id, user_name, ip_address, count) VALUES (?, ?, ?, ?)"; $statement = $db->prepare($sql_2); $statement->execute(array($image_id, $user_name, $ip_address, 0)); } else if ($compare_id == $image_id){ $count = $count++; $sql_3 = "INSERT INTO tracking_table (count) VALUES (?)"; $statement = $db->prepare($sql_3); $statement->execute($count); }
×
×
  • 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.