Webmaster Forum Logo Part 1 Webmaster Forum Logo Part 2
Webmaster Forum Logo Part 3
     
 
  :: Anmeldung

Benutzername:

Registrierung...

Passwort:

Passwort vergessen?

angemeldet bleiben


  
  :: Umfrage
Welche sozialen Netzwerke benutzt du regelmäßig?

 Facebook
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 73%
 keines
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 22%
 Google+
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 19%
 Twitter
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 11%
 Xing
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 6%
 schülerVZ
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 6%
 meinVZ
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 4%
 studiVZ
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 4%
 MySpace
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 2%
 LinkedIn
 Webmaster - WebspaceWebmaster - WebspaceWebmaster - Webspace 2%

 ges. 393 Stimmen
 
  :: Buttons

Valid XHTML 1.0 Transitional

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

1 Zum Seitenanfang

Mittwoch, 1. Juli 2009, 16:24

SQL Syntaxfehler beim schreiben einer Datenbank

Hi, ich hab mal wieder ein problem. ich habe mir ein script gebastelt, welches eine datenbank beschreibt aus einem
html formular. so nun hab ich das ganze in klein gemacht und es klappt, nachdem ich das kleine probescript erweitert
habe kommt folgende fehlermeldung :

Error adding new bike: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'references='', yid='', add_date=CURDATE(), aid='4'' at line 42

das skript dazu lautet:

MySQL-Abfrage(n)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
if (isset($_POST['hubraum'])):

  $aid 	= $_POST['aid'];

  $model   = $_POST['model'];



  $e_price = $_POST['e_price'];
  $p_price = $_POST['p_price'];
  $d_price = $_POST['d_price'];

  $engine_type = $_POST['engine_type'];
  $exhaust 	= $_POST['exhaust'];
  $hubraum 	= $_POST['hubraum'];
  $bore    	= $_POST['bore'];
  $stroke  	= $_POST['stroke'];
  $compression = $_POST['compression'];
  $hp      	= $_POST['hp'];
  $hp_rpm  	= $_POST['hp_rpm'];
  $torque  	= $_POST['torque'];
  $torque_rpm  = $_POST['torque_rpm'];
  $valve_train = $_POST['valve_train'];
  $induction   = $_POST['induction'];

  $transmission = $_POST['transmission'];
  $clutch   	= $_POST['clutch'];
  $final_drive  = $_POST['final_drive'];
  $speed    	= $_POST['speed'];

  $frame          	= $_POST['frame'];
  $front_suspension   = $_POST['front_suspension'];
  $rear_suspension	= $_POST['rear_suspension'];
  $front_break    	= $_POST['front_break'];
  $rear_break     	= $_POST['rear_break'];
  $front_tire     	= $_POST['front_tire'];
  $rear_tire      	= $_POST['rear_tire'];

  $ignition = $_POST['ignition'];
  $charging = $_POST['charging'];
  $battery  = $_POST['battery'];

  $overall_length    	= $_POST['overall_length'];
  $overall_width     	= $_POST['overall_width'];
  $seat_height       	= $_POST['seat_height'];
  $weight_dry        	= $_POST['weight_dry'];
  $weight_wet        	= $_POST['weight_wet'];
  $max_weight        	= $_POST['max_weight'];
  $fuel_capacity     	= $_POST['fuel_capacity'];
  $reserve_fuel_capacity = $_POST['reserve_fuel_capacity'];
  $oil_capacity      	= $_POST['oil_capacity'];

  $description = $_POST['description'];
  $references  = $_POST['references'];


  $cats  = $_POST['cats'];
  $years = $_POST['years'];

  if ($aid == '') {
	exit('<p>You must choose a manufacturer for this bike. Click "Back" and try again.</p>');
  }

$sql = "INSERT INTO bike SET
model   = '$model',
e_price = '$e_price',
p_price = '$p_price',
d_price = '$d_price',
engine_type = '$engine_type',
exhaust 	= '$exhaust',
hubraum 	= '$hubraum',
bore    	= '$bore',
(...)
weight_wet        	= '$weight_wet',
max_weight        	= '$max_weight',
fuel_capacity     	= '$fuel_capacity',
reserve_fuel_capacity = '$reserve_fuel_capacity',
oil_capacity      	= '$oil_capacity',
description='$description',
references='$references',
yid='$yid',
add_date=CURDATE(),
aid='$aid'";

  if (@mysql_query($sql)) {
	echo '<p>New bike added</p>';
  } else {
	exit('<p>Error adding new bike: ' . mysql_error() . '</p>');
  }

  $jid = mysql_insert_id();

  if (isset($_POST['cats'])) {
	$cats = $_POST['cats'];
  } else {
	$cats = array();
  }

  $numCats = 0;
  foreach ($cats as $catID) {
	$sql = "INSERT IGNORE INTO bikecategory
        	SET jokeid=$jid, categoryid=$catID";
	$ok = @mysql_query($sql);
	if ($ok) {
  	$numCats = $numCats + 1;
	} else {
  	echo "<p>Error inserting the motorcycle into category $catID: " .
      	mysql_error() . '</p>';
	}
  }

  //////////////////////////////

  if (isset($_POST['years'])) {
	$years = $_POST['years'];
  } else {
	$years = array();
  }

  $numYears = 0;
  foreach ($years as $yearID) {
	$sql = "INSERT IGNORE INTO yearbike
        	SET jokeid=$jid, yearid=$yearID";
	$ok = @mysql_query($sql);
	if ($ok) {
  	$numYears = $numYears + 1;
	} else {
  	echo "<p>Error inserting the motorcycle into year $yearID: " .
      	mysql_error() . '</p>';
	}
  }


?>

<p>Bike was added to <?php echo $numCats; ?> categories and into <?php echo $numYears; ?>.</p>

<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Add another bike</a></p>

<?php
else: 

  $authors = @mysql_query('SELECT id, name FROM author');
  if (!$authors) {
	exit('<p>Unable to obtain author list from the database.</p>');
  }

  $cats = @mysql_query('SELECT id, name FROM category');
  if (!$cats) {
	exit('<p>Unable to obtain category list from the database.</p>');
  }

  $years = @mysql_query('SELECT id, year FROM year_of_release');
  if (!$cats) {
	exit('<p>Unable to obtain year list from the database.</p>');
  }
?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

    	<p>Model :<input name="model" type="text" id="model"></p>

    	<p>Retail Price(&euro;) : <input name="e_price" type="text" id="e_price"></p>
    	(...)
    	<p>Front Tire :<input name="front_tire" type="text" id="front_tire"></p>
    	<p>Rear Tire :<input name="rear_tire" type="text" id="rear_tire"></p>


    	<p>Starter :<input name="ignition" type="text" id="ignition"></p>
    	<p>Charging :<input name="charging" type="text" id="charging"></p>
    	<p>Battery :<input name="battery" type="text" id="battery"></p>


    	<p>Overall Length :<input name="overall_length" type="text" id="overall_length"></p>
    	<p>Overall Width :<input name="overall_width" type="text" id="overall_width"></p>
    	<p>Seat Height :<input name="seat_height" type="text" id="seat_height"></p>
    	<p>Weight dry :<input name="weight_dry" type="text" id="weight_dry"></p>
    	<p>Weight wet :<input name="weight_wet" type="text" id="weight_wet"></p>
    	<p>Weight MAX :<input name="max_weight" type="text" id="max_weight"></p>
    	<p>Fuel Capacity :<input name="fuel_capacity" type="text" id="fuel_capacity"></p>
    	<p>Reserve Fuel Capacity :<input name="reserve_fuel_capacity" type="text" id="reserve_fuel_capacity"></p>
    	<p>Oil Capacity :<input name="oil_capacity" type="text" id="oil_capacity"></p>


<p>Manufacturer ::
<select name="aid" size="1">
  <option selected value="">Select One</option>
  <option value="">---------</option>
<?php
  while ($author = mysql_fetch_array($authors)) {
	$aid = $author['id'];
	$aname = htmlspecialchars($author['name']);
	echo "<option value='$aid'>$aname</option>\n";
  }
?>
</select></p>
<p>Category ::<br>
<?php
  while ($cat = mysql_fetch_array($cats)) {
	$cid = $cat['id'];
	$cname = htmlspecialchars($cat['name']);
	echo "<label><input type='checkbox' name='cats[]' value='$cid' />$cname</label><br />\n";
  }
?>
</p>

<p>Year Of Release ::<br>
<?php
  while ($year = mysql_fetch_array($years)) {
	$yid = $year['id'];
	$yname = htmlspecialchars($year['year']);
	echo "<label><input type='checkbox' name='years[]' value='$yid' />$yname</label><br />\n";
  }
?>
</p>

<p>Description :<br> <textarea name="description" id="description" cols="50" rows="10"></textarea></p>

<p>References : <br> <textarea name="references" id="references" cols="50" rows="10"></textarea></p>

<input type="submit" value="SUBMIT" />
</form>
<?php endif; ?>
</body>
</html>


so der fehler sagt, dass es ein syntax fehler ist, ich finde den aber nirgends, auch nicht in der region wo references ist...
also geändert wurde garnichts außer das die drei listen abschnitte (einmal im html formular, dann wo formular ausgelesen wird und zuletzt
das ausgelesene in die datenbank schreiben also das INSERT INTO bike SET)
nur mehr einträge haben, sonst hat sich nichts verändert.

danke euch schonmal im voraus
:wacko:

achso da wo (...)im code ist, hab ich was ausgelassen, da der post zu lang ist...

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »zerc« (1. Juli 2009, 16:24)

 

okki

unregistriert

2 Zum Seitenanfang

Mittwoch, 1. Juli 2009, 16:46

Du verwechselst UPDATE mit INSERT. Einen neuen Datenbankeintrag erstellst du mit

Quellcode

1
INSERT INTO table_name VALUES (value1, value2, value3,...)

Bereits erstellte Einträge kannst du mit

Quellcode

1
UPDATE table_name SET column=value1
ändern.

Grüße okki
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

3 Zum Seitenanfang

Mittwoch, 1. Juli 2009, 16:55

ja das ist mir klar, es geht auch darum einen neuen eintrag zu erstellen.
diese php datei heist newbike.php, damit will ich es mir einfacher machen
die daten einzutragen.

danke aber für die schnelle reaktion

Nachtrag:

Ich habs vergessen gehabt das teil durch den validator zu schicken, nun hab ich das gemacht und er bemeckert mir
praktisch das ganze input formular
meint das der ":" falsch wäre und das am ende jeder zeile vokommende </p ">" hab die mal umgestellt ist es ebenfalls falsch.

also ab zeile 169 bis 225 in dem code bis hat jede zeile mindestens 1 fehler laut dem w3c validator
vielleicht sieht einer ja den fehler...
 

Skittles

Moderator

Dabei seit: 14.02.2004

Beiträge: 3 014

 

4 Zum Seitenanfang

Donnerstag, 2. Juli 2009, 21:39

Bitte gib die genauen Fehlermeldungen an, aus deinen Interpretationen kann man nur raten, was gemeint ist.

~!__/
..o.o

This is Einkaufswagen.
Copy Einkaufswagen into your signature to help him on his way to world domination.
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

5 Zum Seitenanfang

Donnerstag, 2. Juli 2009, 23:37

oh, tut mir leid, hier ist ein screenshot :

HTML

1
<br>


so und hier ist der versuch das ganze reinzu kopieren


link
 

cccpmik

Foren Gott

Dabei seit: 04.09.2007

Beiträge: 2 997

 

6 Zum Seitenanfang

Freitag, 3. Juli 2009, 08:10

ich denke du solltest deine php datei in einem browser anzeigen lassen. dann im browser ansicht >seitenquelltext anzeigen und denn dann bei w3d einfügen nicht den php code selbst

MFG
Mein kleines Projekt
-Cruel Online-
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

7 Zum Seitenanfang

Freitag, 3. Juli 2009, 08:39

hmm, hab das nun gemacht und ist folgendes dabei rausgekommen : 138 fehler , vorher waren es 133 :cursing:
fehlersuche ist echt das letzte, vor allem kreidet er mir die ganzen doppelpunkte in <p></p> an und mindestns 20 mal die hinter ">" beim </html> an

hier nochmal die html seite dazu mit allen fehlern

>>klick<<
 

cccpmik

Foren Gott

Dabei seit: 04.09.2007

Beiträge: 2 997

 

8 Zum Seitenanfang

Freitag, 3. Juli 2009, 08:52

das ist nicht die html seite. oben im im quellcode steht include usw.. schick mal link zu deiner php seite. damit ich sie aufrufen kann und die ganzen eingabe felder sehe und senden button etc
Mein kleines Projekt
-Cruel Online-

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »cccpmik« (3. Juli 2009, 08:52)

 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

9 Zum Seitenanfang

Freitag, 3. Juli 2009, 10:48

link

ich kann echt jede hilfe gebrauchen, der link führt zu der seite
viel erfolg :S

edit: das feld displacement oder hubraum muss immer irgendne zahl enthalten, sonst dürfte nichts gehen,
hab da eine if abfrage die nachschaut ob was eingegeben wird und war zu faul sodass nur ein feld abgefragt
wird

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »zerc« (3. Juli 2009, 10:48)

 

cccpmik

Foren Gott

Dabei seit: 04.09.2007

Beiträge: 2 997

 

10 Zum Seitenanfang

Freitag, 3. Juli 2009, 11:01

so also laut:
http://validator.w3.org/check?uri=http%3…lidator%2F1.654

meckert er rum weil du am ende jedes <input das / vergessen hast also zb
statt
<input name="e_price" type="text" id="e_price">

das einsetzen
<input name="e_price" type="text" id="e_price" />
dann schauen wir mal weiter
Mein kleines Projekt
-Cruel Online-
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

11 Zum Seitenanfang

Freitag, 3. Juli 2009, 18:10

hmm, hab das nun verändert und nun sind es "nur" 22 fehler :thumbsup:
es geht vorran!

so das problem ist aber immer noch, dass wenn ich submit drücke, dass der eine fehler kommt:

Error adding new bike: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'references='', yid='', add_date=CURDATE(), aid='6'' at line 42

hab diese werte gecheckt, rechtschreibung scheint zu stimmen.
ist es möglich, das die werte references und yid garnicht weitergegeben werden aus dem formular?

wurde hier in letzter zeit die mysql version verändert?
vll könnte hier ein problem vorliegen...

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »zerc« (3. Juli 2009, 18:10)

 

cccpmik

Foren Gott

Dabei seit: 04.09.2007

Beiträge: 2 997

 

12 Zum Seitenanfang

Freitag, 3. Juli 2009, 19:14

poste mal dein aktuellen quellcode ich denke deine sql syntax ist falsch
Mein kleines Projekt
-Cruel Online-
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

13 Zum Seitenanfang

Freitag, 3. Juli 2009, 19:52

MySQL-Abfrage(n)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>BikersGate :: Add new bike</title>
<meta http-equiv="content-type"
	content="text/html; charset=iso-8859-1" />
</head>
<body>
<?php
include 'hxl23lldll.php';
if (isset($_POST['hubraum'])):
  $aid=$_POST['aid'];
  $model=$_POST['model'];
  $e_price=$_POST['e_price'];
  $p_price=$_POST['p_price'];
  $d_price=$_POST['d_price'];
  $engine_type=$_POST['engine_type'];
  $exhaust=$_POST['exhaust'];
  $hubraum=$_POST['hubraum'];
  $bore=$_POST['bore'];
  $stroke=$_POST['stroke'];
  $compression=$_POST['compression'];
  $hp=$_POST['hp'];
  $hp_rpm=$_POST['hp_rpm'];
  $torque=$_POST['torque'];
  $torque_rpm=$_POST['torque_rpm'];
  $valve_train=$_POST['valve_train'];
  $induction=$_POST['induction'];
  $transmission=$_POST['transmission'];
  $clutch=$_POST['clutch'];
  $final_drive=$_POST['final_drive'];
  $speed=$_POST['speed'];
  $frame=$_POST['frame'];
  $front_suspension=$_POST['front_suspension'];
  $rear_suspension=$_POST['rear_suspension'];
  $front_break=$_POST['front_break'];
  $rear_break=$_POST['rear_break'];
  $front_tire=$_POST['front_tire'];
  $rear_tire=$_POST['rear_tire'];
  $ignition =$_POST['ignition'];
  $charging =$_POST['charging'];
  $battery  =$_POST['battery'];
  $overall_length=$_POST['overall_length'];
  $overall_width=$_POST['overall_width'];
  $seat_height =$_POST['seat_height'];
  $weight_dry=$_POST['weight_dry'];
  $weight_wet=$_POST['weight_wet'];
  $max_weight=$_POST['max_weight'];
  $fuel_capacity=$_POST['fuel_capacity'];
  $reserve_fuel_capacity=$_POST['reserve_fuel_capacity'];
  $oil_capacity=$_POST['oil_capacity'];
  $description=$_POST['description'];
  $references=$_POST['references'];
  $cats=$_POST['cats'];
  $years=$_POST['years'];
  if ($aid == '') {
	exit('<p>You must choose a manufacturer for this bike. Click "Back" and try again.</p>');
  }
$sql = "INSERT INTO bike SET
model='$model',
e_price='$e_price',
p_price='$p_price',
d_price='$d_price',
engine_type='$engine_type',
exhaust='$exhaust',
hubraum='$hubraum',
bore='$bore',
stroke='$stroke',
compression='$compression',
hp='$hp',
hp_rpm='$hp_rpm',
torque='$torque',
torque_rpm='$torque_rpm',
valve_train='$valve_train',
induction='$induction',
transmission='$transmission',
clutch='$clutch',
final_drive='$final_drive',
speed='$speed',
frame='$frame',
front_suspension='$front_suspension',
rear_suspension='$rear_suspension',
front_break='$front_break',
rear_break='$rear_break',
front_tire='$front_tire',
rear_tire='$rear_tire',
ignition='$ignition',
charging='$charging',
battery='$battery',
overall_length='$overall_length',
overall_width='$overall_width',
seat_height='$seat_height',
weight_dry='$weight_dry',
weight_wet='$weight_wet',
max_weight='$max_weight',
fuel_capacity='$fuel_capacity',
reserve_fuel_capacity ='$reserve_fuel_capacity',
oil_capacity='$oil_capacity',
description='$description',
references='$references',
yid='$yid',
add_date=CURDATE(),
aid='$aid'";
  if (@mysql_query($sql)) {
	echo '<p>New bike added</p>';
  } else {
	exit('<p>Error adding new bike: ' . mysql_error() . '</p>');
  }
  $jid = mysql_insert_id();
  if (isset($_POST['cats'])) {
	$cats = $_POST['cats'];
  } else {
	$cats = array();
  }
  $numCats = 0;
  foreach ($cats as $catID) {
	$sql = "INSERT IGNORE INTO bikecategory
        	SET jokeid=$jid, categoryid=$catID";
	$ok = @mysql_query($sql);
	if ($ok) {
  	$numCats = $numCats + 1;
	} else {
  	echo "<p>Error inserting the motorcycle into category $catID: " .
      	mysql_error() . '</p>';
	}
  }
  //////////////////////////////
  if (isset($_POST['years'])) {
	$years = $_POST['years'];
  } else {
	$years = array();
  }
  $numYears = 0;
  foreach ($years as $yearID) {
	$sql = "INSERT IGNORE INTO yearbike
        	SET jokeid=$jid, yearid=$yearID";
	$ok = @mysql_query($sql);
	if ($ok) {
  	$numYears = $numYears + 1;
	} else {
  	echo "<p>Error inserting the motorcycle into year $yearID: " .
      	mysql_error() . '</p>';
	}
  }
?>
<p>Bike was added to <?php echo $numCats; ?> categories and into <?php echo $numYears; ?>.</p>
<p><a href="<?php echo $_SERVER['PHP_SELF']; ?>">Add another bike</a></p>
<p><a href="jokes.php">Return to the bike - search</a></p>
<?php
else: // Allow the user to enter a new joke
  $authors = @mysql_query('SELECT id, name FROM author');
  if (!$authors) {
	exit('<p>Unable to obtain author list from the database.</p>');
  }
  $cats = @mysql_query('SELECT id, name FROM category');
  if (!$cats) {
	exit('<p>Unable to obtain category list from the database.</p>');
  }
  $years = @mysql_query('SELECT id, year FROM year_of_release');
  if (!$cats) {
	exit('<p>Unable to obtain year list from the database.</p>');
  }
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    	<p>Model :<input name="model" type="text" id="model" /></p>
    	<p>Retail Price(&euro;) : <input name="e_price" type="text" id="e_price" /></p>
    	<p>Retail Price(&pound;) :<input name="p_price" type="text" id="p_price" /></p>
    	<p>Retail Price($) : <input name="d_price" type="text" id="d_price" /></p>
    	<p>Engine Type :<input name="engine_type" type="text" id="engine_type" /></p>
    	<p>Exhaust :<input name="exhaust" type="text" id="exhaust" /></p>
    	<p>Displacement (ccm) :<input name="hubraum" type="text" id="hubraum" /></p>
    	<p>Bore (mm) :<input name="bore" type="text" id="bore" /></p>
    	<p>Stroke (mm) :<input name="stroke" type="text" id="stroke" /></p>
    	<p>Compression :<input name="compression" type="text" id="compression" /></p>
    	<p>Horsepower :<input name="hp" type="text" id="hp" /></p>
    	<p>Horsepower RPM :<input name="hp_rpm" type="text" id="hp_rpm" /></p>
    	<p>Torque :<input name="torque" type="text" id="torque" /></p>
    	<p>Torque RPM :<input name="torque_rpm" type="text" id="torque_rpm" /></p>
    	<p>Valve Train :<input name="valve_train" type="text" id="valve_train" /></p>
    	<p>Induction :<input name="induction" type="text" id="induction" /></p>
    	<p>Transmission :<input name="transmission" type="text" id="transmission" /></p>
    	<p>Clutch :<input name="clutch" type="text" id="clutch" /></p>
    	<p>final drive :<input name="final_drive" type="text" id="final_drive" /></p>
    	<p>Speed :<input name="speed" type="text" id="speed" /></p>
    	<p>Frame :<input name="frame" type="text" id="frame" /></p>
    	<p>Front Suspension :<input name="front_suspension" type="text" id="front_suspension" /></p>
    	<p>Rear Suspension :<input name="rear_suspension" type="text" id="rear_suspension" /></p>
    	<p>Front Break :<input name="front_break" type="text" id="front_break" /></p>
    	<p>Rear Break :<input name="rear_break" type="text" id="rear_break" /></p>
    	<p>Front Tire :<input name="front_tire" type="text" id="front_tire" /></p>
    	<p>Rear Tire :<input name="rear_tire" type="text" id="rear_tire" /></p>
    	<p>Starter :<input name="ignition" type="text" id="ignition" /></p>
    	<p>Charging :<input name="charging" type="text" id="charging" /></p>
    	<p>Battery :<input name="battery" type="text" id="battery" /></p>
    	<p>Overall Length :<input name="overall_length" type="text" id="overall_length" /></p>
    	<p>Overall Width :<input name="overall_width" type="text" id="overall_width" /></p>
    	<p>Seat Height :<input name="seat_height" type="text" id="seat_height" /></p>
    	<p>Weight dry :<input name="weight_dry" type="text" id="weight_dry" /></p>
    	<p>Weight wet :<input name="weight_wet" type="text" id="weight_wet" /></p>
    	<p>Weight MAX :<input name="max_weight" type="text" id="max_weight" /></p>
    	<p>Fuel Capacity :<input name="fuel_capacity" type="text" id="fuel_capacity" /></p>
    	<p>Reserve Fuel Capacity :<input name="reserve_fuel_capacity" type="text" id="reserve_fuel_capacity" /></p>
    	<p>Oil Capacity :<input name="oil_capacity" type="text" id="oil_capacity" /></p>
<p>Manufacturer ::
<select name="aid" size="1">
  <option selected value="">Select One</option>
  <option value="">---------</option>
<?php
  while ($author = mysql_fetch_array($authors)) {
	$aid = $author['id'];
	$aname = htmlspecialchars($author['name']);
	echo "<option value='$aid'>$aname</option>\n";
  }
?>
</select></p>
<p>Category ::<br>
<?php
  while ($cat = mysql_fetch_array($cats)) {
	$cid = $cat['id'];
	$cname = htmlspecialchars($cat['name']);
	echo "<label><input type='checkbox' name='cats[]' value='$cid' />$cname</label><br />\n";
  }
?>
</p>
<p>Year Of Release ::<br>
<?php
  while ($year = mysql_fetch_array($years)) {
	$yid = $year['id'];
	$yname = htmlspecialchars($year['year']);
	echo "<label><input type='checkbox' name='years[]' value='$yid' />$yname</label><br />\n";
  }
?>
</p>
<p>Description :<br> <textarea name="description" id="description" cols="50" rows="10"></textarea></p>
<p>References : <br> <textarea name="references" id="references" cols="50" rows="10"></textarea></p>
<input type="submit" value="SUBMIT" />
</form>
<?php endif; ?>
</body>
</html>
 

cccpmik

Foren Gott

Dabei seit: 04.09.2007

Beiträge: 2 997

 

14 Zum Seitenanfang

Freitag, 3. Juli 2009, 21:08

habe ich mir doch gedacht. nicht insert into set=sowieso sondern

INSERT INTO tabelle(spalte1,spalte2,spalte3,etc..) VALUES('wert1','wert2','wert3',..);

  Spoiler Spoiler

MySQL-Abfrage(n)

1
$sql = "INSERT INTO bike(model,e_price,p_price,...) VALUES($model,$e_price,$p_price,...)";
Mein kleines Projekt
-Cruel Online-
 

Skittles

Moderator

Dabei seit: 14.02.2004

Beiträge: 3 014

 

15 Zum Seitenanfang

Samstag, 4. Juli 2009, 11:36

Man kann auch SET benutzen, siehe http://dev.mysql.com/doc/refman/5.1/en/insert.html

Es liegt daran, dass references ein MySQL-Befehl ist. Es empfiehlt sich daher Spaltennamen in ` (Achtung nicht ') zu setzen:

MySQL-Abfrage(n)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
INSERT INTO bike SET
`model`='$model',
`e_price`='$e_price',
`p_price`='$p_price',
`d_price`='$d_price',
`engine_type`='$engine_type',
`exhaust`='$exhaust',
`hubraum`='$hubraum',
`bore`='$bore',
`stroke`='$stroke',
`compression`='$compression',
`hp`='$hp',
`hp_rpm`='$hp_rpm',
`torque`='$torque',
`torque_rpm`='$torque_rpm',
`valve_train`='$valve_train',
`induction`='$induction',
`transmission`='$transmission',
`clutch`='$clutch',
`final_drive`='$final_drive',
`speed`='$speed',
`frame`='$frame',
`front_suspension`='$front_suspension',
`rear_suspension`='$rear_suspension',
`front_break`='$front_break',
`rear_break`='$rear_break',
`front_tire`='$front_tire',
`rear_tire`='$rear_tire',
`ignition`='$ignition',
`charging`='$charging',
`battery`='$battery',
`overall_length`='$overall_length',
`overall_width`='$overall_width',
`seat_height`='$seat_height',
`weight_dry`='$weight_dry',
`weight_wet`='$weight_wet',
`max_weight`='$max_weight',
`fuel_capacity`='$fuel_capacity',
`reserve_fuel_capacity`='$reserve_fuel_capacity',
`oil_capacity`='$oil_capacity',
`description`='$description',
`references`='$references',
`yid`='$yid',
`add_date`=CURDATE(),
`aid`='$aid'

~!__/
..o.o

This is Einkaufswagen.
Copy Einkaufswagen into your signature to help him on his way to world domination.
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

16 Zum Seitenanfang

Samstag, 4. Juli 2009, 16:52

also, ich habe beide wege ausprobiert und sowohl von cccpmik als auch von Skittles lösungsmöglichkeiten funktionieren,
nun läuft alles,
das ist wiedermal so typisch, denke der hat den references teil als einen teilbefehl sowie CURDATE(); oder ähnliches versucht
zu interpretieren,

wie so oft machen die details probleme ;)

ich danke nochmals allen, die geholfen haben
:thumbsup:
 

Skittles

Moderator

Dabei seit: 14.02.2004

Beiträge: 3 014

 

17 Zum Seitenanfang

Sonntag, 5. Juli 2009, 09:18

Dagegen hilft: Sauberen Code schreiben

~!__/
..o.o

This is Einkaufswagen.
Copy Einkaufswagen into your signature to help him on his way to world domination.
 

zerc

Foren As

Dabei seit: 18.01.2004

Beiträge: 79

 

18 Zum Seitenanfang

Sonntag, 5. Juli 2009, 19:42

ja,bestimmt,
es ist nur schwer, wenn es
eines der ersten mysql sachen ist.
hab gedacht,dass es richtig ist wie das geschrieben
wurde, da ich es in einem tutorial gelesen habe.

so kann man sich irren ;)
 

Ähnliche Themen