Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL][PHP] Niespodziewane T_LNUMBER
$_GET['Kuba']
post 20.02.2011, 14:38:02
Post #1





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 19.02.2011

Ostrzeżenie: (0%)
-----


Witam, znowu mam problem:
Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in /dota/generate.php on line 4
Generate.php
  1. <?php
  2. $id = 0;
  3. $id = $id + 1;
  4. $1lvl = $_POST['1lvl'];
  5. $2lvl = $_POST['2lvl'];
  6. $3lvl = $_POST['3lvl'];
  7. $4lvl = $_POST['4lvl'];
  8. $5lvl = $_POST['5lvl'];
  9. $6lvl = $_POST['6lvl'];
  10. $7lvl = $_POST['7lvl'];
  11. $8lvl = $_POST['8lvl'];
  12. $9lvl = $_POST['9lvl'];
  13. $10lvl = $_POST['10lvl'];
  14. $11lvl = $_POST['11lvl'];
  15. $12lvl = $_POST['12lvl'];
  16. $13lvl = $_POST['13lvl'];
  17. $14lvl = $_POST['14lvl'];
  18. $15lvl = $_POST['15lvl'];
  19. $16lvl = $_POST['16lvl'];
  20. $17lvl = $_POST['17lvl'];
  21. $18lvl = $_POST['18lvl'];
  22. $txt = $_POST['txt'];
  23. include 'includes/config.php';
  24. include 'includes/opendphp';
  25. $ins = @mysql_query("INSERT INTO admiral SET id='$id', 1lvl='$1lvl', 2lvl='$2lvl', 3lvl='$3lvl', 4lvl='$4lvl', 5lvl='$5lvl', 6lvl='$6lvl', 7lvl='$7lvl', 8lvl='$8lvl', 9lvl='$9lvl', 10lvl='$10lvl', 11lvl='$11lvl', 12lvl='$12lvl', 13lvl='$13lvl',
  26. 14lvl='$14lvl', 15lvl='$15lvl', 16lvl='$16lvl', 17lvl='$17lvl', 18lvl='$18lvl', txt='$txt'");
  27. if($ins)
  28. echo "Rekord został dodany poprawnie";
  29. else
  30. echo "Błąd nie udało się dodać nowego rekordu";
  31. ?>


opendb.php
  1. <?php
  2. $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
  3. mysql_select_db($dbname);
  4. ?>

W config.php mam dane do bazy.
EDIT: Aha jeszcze formularz.
index.php
  1. <head>
  2. <link rel="stylesheet" href="style.css" type="text/css">
  3. <script language="javascript" type="text/javascript" src="/js/jquery-1.4.4.min.js"></script>
  4. <script src="js/jquery-1.4.4.min.js"></script>
  5. <script src="js/jquery-ui-1.8.9.custom.min.js"></script>
  6. $(document).ready(function() {
  7. $("#accordion").accordion();
  8. });
  9. </script>
  10. <title>Admiral Build
  11. </title>
  12. </head>
  13. <img src="images/header.jpg"/>
  14. <div id="accordion">
  15. <h3><a href="#">Skills</a></h3>
  16. <div height="600">
  17. <form action="generate.php" method="post">
  18. <tr>
  19. <td>Ability</td>
  20. <td width="20"> 1</td>
  21. <td width="20"> 2</td>
  22. <td width="20"> 3</td>
  23. <td width="20"> 4</td>
  24. <td width="20"> 5</td>
  25. <td width="20"> 6</td>
  26. <td width="20"> 7</td>
  27. <td width="20"> 8</td>
  28. <td width="20"> 9</td>
  29. <td width="20">10</td>
  30. <td width="20">11</td>
  31. <td width="20">12</td>
  32. <td width="20">13</td>
  33. <td width="20">14</td>
  34. <td width="20">15</td>
  35. <td width="20">16</td>
  36. <td width="20">17</td>
  37. <td width="20">18</td>
  38. </tr>
  39. <tr>
  40. <td width="20">
  41. <img src="images/skill-1-mini.jpg" width="20" height="20" /><br>
  42. <img src="images/skill-2-mini.jpg" width="20" height="20" /><br>
  43. <img src="images/skill-3-mini.jpg" width="20" height="20" /><br>
  44. <img src="images/skill-4-mini.jpg" width="20" height="20" /><br>
  45. </td>
  46. <td width="20">
  47. <div class="column">
  48. <input type=radio name=1lvl value="1"/><br>
  49. <input type=radio name=1lvl value="2"/><br>
  50. <input type=radio name=1lvl value="3"/><br>
  51. <input type=radio name=1lvl value="4"/>
  52. </div>
  53. </td>
  54. <td width="20">
  55. <div class="column">
  56. <input type=radio name=2lvl value="1"/><br>
  57. <input type=radio name=2lvl value="2"/><br>
  58. <input type=radio name=2lvl value="3"/><br>
  59. <input type=radio name=2lvl value="4"/>
  60. </div>
  61. </td>
  62. <td width="20">
  63. <div class="column">
  64. <input type=radio name=3lvl value="1"/><br>
  65. <input type=radio name=3lvl value="2"/><br>
  66. <input type=radio name=3lvl value="3"/><br>
  67. <input type=radio name=3lvl value="4"/>
  68. </div>
  69. </td>
  70. <td width="20">
  71. <div class="column">
  72. <input type=radio name=4lvl value="1"/><br>
  73. <input type=radio name=4lvl value="2"/><br>
  74. <input type=radio name=4lvl value="3"/><br>
  75. <input type=radio name=4lvl value="4"/>
  76. </div>
  77. </td>
  78. <td width="20">
  79. <div class="column">
  80. <input type=radio name=5lvl value="1"/><br>
  81. <input type=radio name=5lvl value="2"/><br>
  82. <input type=radio name=5lvl value="3"/><br>
  83. <input type=radio name=5lvl value="4"/>
  84. </div>
  85. </td>
  86. <td width="20">
  87. <div class="column">
  88. <input type=radio name=6lvl value="1"/><br>
  89. <input type=radio name=6lvl value="2"/><br>
  90. <input type=radio name=6lvl value="3"/><br>
  91. <input type=radio name=6lvl value="4"/>
  92. </div>
  93. </td>
  94. <td width="20">
  95. <div class="column">
  96. <input type=radio name=7lvl value="1"/><br>
  97. <input type=radio name=7lvl value="2"/><br>
  98. <input type=radio name=7lvl value="3"/><br>
  99. <input type=radio name=7lvl value="4"/>
  100. </div>
  101. </td>
  102. <td width="20">
  103. <div class="column">
  104. <input type=radio name=8lvl value="1"/><br>
  105. <input type=radio name=8lvl value="2"/><br>
  106. <input type=radio name=8lvl value="3"/><br>
  107. <input type=radio name=8lvl value="4"/>
  108. </div>
  109. </td>
  110. <td width="20">
  111. <div class="column">
  112. <input type=radio name=9lvl value="1"/><br>
  113. <input type=radio name=9lvl value="2"/><br>
  114. <input type=radio name=9lvl value="3"/><br>
  115. <input type=radio name=9lvl value="4"/>
  116. </div>
  117. </td>
  118. <td width="20">
  119. <div class="column">
  120. <input type=radio name=10lvl value="1"/><br>
  121. <input type=radio name=10lvl value="2"/><br>
  122. <input type=radio name=10lvl value="3"/><br>
  123. <input type=radio name=10lvl value="4"/>
  124. </div>
  125. </td>
  126. <td width="20">
  127. <div class="column">
  128. <input type=radio name=11lvl value="1"/><br>
  129. <input type=radio name=11lvl value="2"/><br>
  130. <input type=radio name=11lvl value="3"/><br>
  131. <input type=radio name=11lvl value="4"/>
  132. </div>
  133. </td>
  134. <td width="20">
  135. <div class="column">
  136. <input type=radio name=12lvl value="1"/><br>
  137. <input type=radio name=12lvl value="2"/><br>
  138. <input type=radio name=12lvl value="3"/><br>
  139. <input type=radio name=12lvl value="4"/>
  140. </div>
  141. </td width="20">
  142. <td>
  143. <div class="column">
  144. <input type=radio name=13lvl value="1"/><br>
  145. <input type=radio name=13lvl value="2"/><br>
  146. <input type=radio name=13lvl value="3"/><br>
  147. <input type=radio name=13lvl value="4"/>
  148. </div>
  149. </td>
  150. <td width="20">
  151. <div class="column">
  152. <input type=radio name=14lvl value="1"/><br>
  153. <input type=radio name=14lvl value="2"/><br>
  154. <input type=radio name=14lvl value="3"/><br>
  155. <input type=radio name=14lvl value="4"/>
  156. </div>
  157. </td>
  158. <td width="20">
  159. <div class="column">
  160. <input type=radio name=15lvl value="1"/><br>
  161. <input type=radio name=15lvl value="2"/><br>
  162. <input type=radio name=15lvl value="3"/><br>
  163. <input type=radio name=15lvl value="4"/>
  164. </div>
  165. </td>
  166. <td width="20">
  167. <div class="column">
  168. <input type=radio name=16lvl value="1"/><br>
  169. <input type=radio name=16lvl value="2"/><br>
  170. <input type=radio name=16lvl value="3"/><br>
  171. <input type=radio name=16lvl value="4"/>
  172. </div>
  173. </td>
  174. <td width="20">
  175. <div class="column">
  176. <input type=radio name=17lvl value="1"/><br>
  177. <input type=radio name=17lvl value="2"/><br>
  178. <input type=radio name=17lvl value="3"/><br>
  179. <input type=radio name=17lvl value="4"/>
  180. </div>
  181. </td>
  182. <td width="20">
  183. <div class="column">
  184. <input type=radio name=18lvl value="1"/><br>
  185. <input type=radio name=18lvl value="2"/><br>
  186. <input type=radio name=18lvl value="3"/><br>
  187. <input type=radio name=18lvl value="4"/>
  188. </div>
  189. </td>
  190. </tr>
  191. </table>
  192. </div>
  193. <h3><a href="#">Additional Tips</a></h3>
  194. <div height="600">
  195. <textarea style="font-size: small;" name="txt" rows="10" cols="100">
  196. Write there additional hints. You can use html for <b>bold</b>, <i>italic</i> or <u>underlined</u> text
  197. </div>
  198. </div>
  199. <div>
  200. <input type=submit value="Submit"/>
  201. </div>
  202. </form>
  203. </center></body>
  204. </html>


Ten post edytował $_GET['Kuba'] 20.02.2011, 14:40:51
Go to the top of the page
+Quote Post
greycoffey
post 20.02.2011, 14:49:09
Post #2





Grupa: Zarejestrowani
Postów: 320
Pomógł: 29
Dołączył: 3.04.2010

Ostrzeżenie: (20%)
X----


Zmiennych nie można zaczynać od cyfr.
Go to the top of the page
+Quote Post
$_GET['Kuba']
post 20.02.2011, 15:04:32
Post #3





Grupa: Zarejestrowani
Postów: 19
Pomógł: 0
Dołączył: 19.02.2011

Ostrzeżenie: (0%)
-----


Już nic biggrin.gif

Ten post edytował $_GET['Kuba'] 20.02.2011, 15:22:49
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 12.06.2024 - 00:43