Jump to content
php.lv forumi

Mysql query


Galedajs

Recommended Posts

Sveiki visiem, kas so lasa!

 

Es meginu ielikt ieksa mysql datu baze web adresi, bet es nezinu kadus parametrus jauzstada ieks table. Tur vajag varchar, vai ko citu?

Mans query:

 

Pats query vispar ir pareizs?

 

INSERT INTO user (name, surname, adult, img, sex, time, normal, special) VALUES(Janis, Janis,

1, http://inbox.lv, M, NOW(), '5', '1')

 

Un no ta izmet sadu error:

ERROR: Unknown Punctuation String @ 113

STR: ://

 

#1064 - 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 '://inbox.lv, M, NOW(), '5', '1')' at line 2

 

Paldies par palidzibu.

Link to comment
Share on other sites

INSERT INTO user (name, surname, adult, img, sex, time, normal, special) VALUES('Janis','Janis','1','inbox.lv','M', NOW(), '5', '1' ) 

ja nē liec dubult pēdiņas bet pacik te nekā tāda nau tad būtu jaiet :) ja atmiņa neviļ :)

Edited by Faks
Link to comment
Share on other sites

Iesaku likt tabulas nosaukumu un kolonas "bektikos", tas būtu:

 

INSERT INTO `user` ('username`, `password`) ...

 

Tas novērsīs kļūdas, kas var rasties, ja tāds nosaukums ir MySQL jau rezervētais vārds.

 

Izmanto lielos burtus vārdiem, kas ir MySQL jau rezervētie vārdi - redzu, ka jau tā dari. Tas padarīs kveriju lasāmāku acīm.

 

Sadali kaut kā visu kveriju pa daļām un katru daļu liec jaunā rindiņā. Piemērs:

 

INSERT INTO ...
WHERE ...
LIMIT ...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...