Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MYSQL] błąd zapytania?
-lilboi-
post
Post #1





Goście







  1. <?php
  2. $jak = rand(1, 10);
  3. $mat = rand(1, 10);
  4. $typ = rand(1, 26);
  5. $attrib = ceil(rand(95,105)/20*$typ*sqrt($mat*$mat*$jak))+$mat+$jak;
  6. doquery("INSERT INTO {{table}} SET primary='$attrib',quality='$jak',material='$mat',kind='$typ',owner='".$userrow["id"]."',secondary='X'" , "equipment");
  7. ?>

daje mi efekt:
Kod
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 'primary='1173',quality='9',material='9',kind='9',owner='1',secondary='X'' at line 1



a żeby było śmieszniej
  1. <?php
  2. $jak = rand(1, 10);
  3. $mat = rand(1, 10);
  4. $typ = rand(1, 26);
  5. $attrib = ceil(rand(95,105)/20*$typ*sqrt($mat*$mat*$jak))+$mat+$jak;
  6. doquery("INSERT INTO {{table}} SET quality='$jak',material='$mat',kind='$typ',owner='".$userrow["id"]."',secondary='X'" , "equipment");
  7. ?>

działa (usunąłem tylko primary='$attrib',).


i trzecie podejście:
  1. <?php
  2. $jak = rand(1, 10);
  3. $mat = rand(1, 10);
  4. $typ = rand(1, 26);
  5. $attrib = 1;
  6. doquery("INSERT INTO {{table}} SET primary='$attrib',quality='$jak',material='$mat',kind='$typ',owner='".$userrow["id"]."',secondary='X'" , "equipment");
  7. ?>

też nie przynosi oczekiwanych rezultatów:
Kod
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 'primary='1',quality='9',material='10',kind='14',owner='1',secondary='X'' at line 1




I na tym moje pomysły się kończą, można prosić o radę jak naprawić zapytanie? wszystkie kolumny tabeli są UNSIGNED mediumintint(15).
Go to the top of the page
+Quote Post

Posty w temacie
- lilboi   [PHP][MYSQL] błąd zapytania?   12.10.2008, 09:47:00
- - melkorm   daj [SQL] pobierz, plaintext `primary`[SQL] pobier...   12.10.2008, 10:09:36
- - Gość   Zgadza się, na to bym nie wpadł, dzięki W sumie....   12.10.2008, 10:37:18


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 Aktualny czas: 20.08.2025 - 15:43