login  Naam:   Wachtwoord: 
Registreer je!
 Forum

Rare MySQL error?

Offline BigBug - 02/01/2006 12:36
Avatar van BigBugPHP expert Duplicate entry '0' for key 1

Deze mysql_error krijg ik.. Ik heb dit script:

  1. <?php
  2. include 'config.php';
  3. connect();
  4. ?>
  5. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml">
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  9. <title>Uitslagen toevoegen</title>
  10. </head>
  11.  
  12. <body>
  13. <?php
  14. ############################################
  15. # CREATE TABLE `uitslagen` ( #
  16. # `id` INT NOT NULL , #
  17. # `datum` VARCHAR( 255 ) NOT NULL , #
  18. # `speel` VARCHAR( 255 ) NOT NULL , #
  19. # `uitslag` VARCHAR( 255 ) NOT NULL , #
  20. # PRIMARY KEY ( `id` ) #
  21. # ) TYPE = MYISAM ; #
  22. ############################################
  23.  
  24. if($_SERVER['REQUEST_METHOD'] == "POST")
  25. {
  26. if(empty($_POST['thuis']) or empty($_POST['uit']) or empty($_POST['scorethuis']) or empty($_POST['scoreuit']))
  27. {
  28. echo 'Je hebt niet alles ingevuld!';
  29. }
  30. else
  31. {
  32. $datum = "".$_POST['dag']." - ".$_POST['maand']." - ".$_POST['jaar']."";
  33. $wievswie = "".$_POST['thuis']." - ".$_POST['uit']."";
  34. $score = "".$_POST['scorethuis']." - ".$_POST['scoreuit']."";
  35.  
  36. mysql_query("INSERT INTO uitslagen (datum, speel, uitslag) VALUES ('".$datum."','".$wievswie."','".$score."')") or die(mysql_error());
  37. echo 'Uitslag gepost!';
  38. }
  39. }
  40. ?>
  41. <form name="uitslagen" method="post" action="">
  42. <table style="border: 1px solid black;">
  43. <tr>
  44. <td>Datum: </td>
  45. <td>
  46. <select name="dag">
  47. <option value='1'>1</option>
  48. <option value='2'>2</option>
  49. <option value='3'>3</option>
  50. <option value='4'>4</option>
  51. <option value='5'>5</option>
  52. <option value='6'>6</option>
  53. <option value='7'>7</option>
  54. <option value='8'>8</option>
  55. <option value='9'>9</option>
  56. <option value='10'>10</option>
  57. <option value='11'>11</option>
  58. <option value='12'>12</option>
  59. <option value='13'>13</option>
  60. <option value='14'>14</option>
  61. <option value='15'>15</option>
  62. <option value='16'>16</option>
  63. <option value='17'>17</option>
  64. <option value='18'>18</option>
  65. <option value='19'>19</option>
  66. <option value='20'>20</option>
  67. <option value='21'>21</option>
  68. <option value='22'>22</option>
  69. <option value='23'>23</option>
  70. <option value='24'>24</option>
  71. <option value='25'>25</option>
  72. <option value='26'>26</option>
  73. <option value='27'>27</option>
  74. <option value='28'>28</option>
  75. <option value='29'>29</option>
  76. <option value='30'>30</option>
  77. <option value='31'>31</option>
  78. </select>&nbsp;
  79. <select name="maand">
  80. <option value='Januari'>Januari</option>
  81. <option value='Februari'>Februari</option>
  82. <option value='Maart'>Maart</option>
  83. <option value='April'>April</option>
  84. <option value='Mei'>Mei</option>
  85. <option value='Juni'>Juni</option>
  86. <option value='Juli'>Juli</option>
  87. <option value='Augustus'>Augustus</option>
  88. <option value='September'>September</option>
  89. <option value='Oktober'>Oktober</option>
  90. <option value='November'>November</option>
  91. <option value='December'>December</option>
  92. </select>&nbsp;
  93. <select name="jaar">
  94. <option value='2005'>2005</option>
  95. <option value='2006'>2006</option>
  96. <option value='2007'>2007</option>
  97. </select>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td>Wie tegen wie: </td>
  102. <td>
  103. <table border="0">
  104. <tr>
  105. <td>Thuis: </td><td><input type="text" name="thuis" /></td>
  106. </tr>
  107. <tr>
  108. <td>Uit: </td><td><input type="text" name="uit" /></td>
  109. </tr>
  110. </table>
  111. </td>
  112. </tr>
  113. <tr>
  114. <td>Uitslag: </td>
  115. <td>
  116. <table border="0">
  117. <tr>
  118. <td>Thuis: </td><td><input type="text" name="scorethuis" size="4" /></td>
  119. </tr>
  120. <tr>
  121. <td>Uit: </td><td><input type="text" name="scoreuit" size="4"/></td>
  122. </tr>
  123. </table>
  124. </td>
  125. </tr>
  126. <tr>
  127. <td></td>
  128. <td><input type="submit" name="submit" value="Post deze uitslag!" /></td>
  129. </tr>
  130. </table>
  131. </form>
  132.  
  133. </body>
  134. </html>


Ik snap het niet meer.. Al een tijdje beziggeweest..

Alvast bedankt, Jeroen

0 antwoorden

Gesponsorde links
Er zijn nog geen reacties op dit bericht.
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2025 Sitemasters.be - Regels - Laadtijd: 0.184s