Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> SQL syntax - problem ze zmiennymi
haribol
post
Post #1





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 18.12.2012

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


Witam.
  1. $rejestracja = mysql_query("INSERT INTO `users` (id,name,mail,data,relationship,location) VALUES (".$user.",".$user_profile[first_name].",".$user_profile[email].",".$user_profile[birthday].",".$user_profile[relationship_status].",".$user_profile[location].")") or die(mysql_error());

i błąd, który mi wyskakuje:
  1. 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 '@hotmail.com,09/09/1991,In a Relationship,Array)' at line 1


Dzięki z góry
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 9)
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Wartosci tekstowe do zapytania wklada się w apostrofach. Ty tego nie robisz


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
haribol
post
Post #3





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 18.12.2012

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


Cytat(nospor @ 22.02.2013, 16:51:41 ) *
Wartosci tekstowe do zapytania wklada się w apostrofach. Ty tego nie robisz

tera mam: Unknown column 'id' in 'field list'
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Komunikat błedu chyba jest wyraźny...... NIe ma kolumny id...


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
haribol
post
Post #5





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 18.12.2012

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


ale ta kolumna jest smile.gif
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




wg mysql jej nie ma. A mysql z regóły nie kłamie.

Może masz ID zamiast id, a może pomyliły ci się tabele wink.gif

a pozatym pokaż kod po zmianach


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
haribol
post
Post #7





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 18.12.2012

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


  1. <?php
  2. // Delimiters may be slash, dot, or hyphen
  3. $date = $user_profile[birthday];
  4. list($month, $day, $year) = split('[/.-]', $date);
  5. require_once 'base.php';
  6. $userbase = mysql_query("SELECT * FROM `users` WHERE id='$user'");
  7. echo "ok";
  8.  
  9. if(mysql_num_rows($userbase)==0){
  10. $rejestracja = mysql_query("INSERT INTO `users` (id,name,mail,data,relationship,location) VALUES ('$user','$user_profile[first_name]','$user_profile[email]','$user_profile[birthday]','$user_profile[relationship_status]','$user_profile[location]')") or die(mysql_error());
  11. mysql_free_result($userbase);
  12. mysql_free_result($rejestracja);
  13. };
  14.  
  15.  
  16.  
  17. ?>
Go to the top of the page
+Quote Post
nospor
post
Post #8





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




No i nadal: jak baza mowi, że nie ma pola id, to znaczy ze nie ma smile.gif Poszukaj smile.gif


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
haribol
post
Post #9





Grupa: Zarejestrowani
Postów: 44
Pomógł: 0
Dołączył: 18.12.2012

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


nie łączyłem się z tą bazą co trza. jaaaa.
ps. co to? biggrin.gif No such file or directory

Ten post edytował haribol 22.02.2013, 18:05:29
Go to the top of the page
+Quote Post
nospor
post
Post #10





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Cytat
ps. co to? No such file or directory
Komunikat błędu poraz kolejny jest przecież dość wyraźny i oczywisty...


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

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 Aktualny czas: 21.08.2025 - 05:06