Jump to content

Search the Community

Showing results for tags 'duplicate entry 0 for key'.

  • 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. This is my error in my Vote script: Duplicate entry '0' for key 'PRIMARY'. I did changned in phpmyadmin but he automaticly go's to 0 and everytime I wanna vote I get this error. Here's my website code: <?php session_start(); require_once 'assets/config/config.php'; $pageName = "Runelab - Vote Server"; ?> <?php include 'assets/templates/overall/overallHead.php'; ?> <?php include 'assets/templates/navHead.php'; ?> <div id="res_content" > <h2>Vote Your Server</h2> <center> <p>Server name you want to vote.</p> <?php $note = '<form method="GET" action="vote.php"><input name="servername"/><input type="submit" value="Vote" /></form>'; $variable = ""; $ip = $_SERVER['REMOTE_ADDR']; include('assets/config/config.php'); if(isset($_GET['servername'])){ $sn = $_GET['servername']; $username = mysql_real_escape_string($row['username']); $SQL = "SELECT * FROM id WHERE ip = '$ip'"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { $variable = $db_field['edate']; } $dates = date("Ymd"); if($variable == $dates){ header( 'location: votes.php?action=false' ); die(); } else { mysql_query("DELETE FROM id WHERE ip = '$ip' AND Name='$sn'"); } $query = mysql_query("SELECT * FROM clients WHERE servername='$sn'"); if(mysql_num_rows($query) != 0) { $SQL = "SELECT * FROM clients WHERE servername='$sn'"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { $votes = $db_field['Votes']; $newvotes = $votes + 1; mysql_query("UPDATE clients SET votes = votes + 1 WHERE servername = '$sn'"); $date = date("Ymd"); mysql_query("INSERT INTO id (ip, edate, Name) VALUES('$ip', '$date', '$sn')") or die(mysql_error()); header( 'location: votes.php?action=true' ); die(); } } } else { $note = '<form method="GET" action="vote.php"><input name="servername" /><input type="submit" value="Vote" /></form>'; } ?> <?php echo $note; ?></center></div> <?php include 'assets/templates/overall/overallFoot.php'; ?> and Here's mysql code: CREATE TABLE IF NOT EXISTS `id` ( `ID` int(255) NOT NULL, `ip` varchar(255) COLLATE latin1_general_ci NOT NULL, `edate` varchar(255) COLLATE latin1_general_ci NOT NULL, `Name` varchar(255) COLLATE latin1_general_ci NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
×
×
  • 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.