Edifice Posted February 12, 2009 Share Posted February 12, 2009 A couple of days ago I found an example somewhere, great one actually. However, it has these two lines in it: If $retarr[0] <> "" Then _SQLite_Exec($dbn,"UPDATE datas SET id='"&$str1&"', modtager='"&$str2&"',timeanddate='"&$str3&"' ,navn='"&$str4&"' ,telefonnummer='"&$str5&"',email='"&$str6&"' ,indleveret='"&$str7&"',garanti='"&$str8&"' ,fakturanummer='"&$str9&"' ,color='"&$str10&"' ,brand='"&$str11&"' ,diversebeskrivelse='"&$str12&"' ,accesory='"&$str13&"' ,diversetlbhr='"&$str14&"' ,fejlbeskrivelse='"&$str15&"' ,antaltimer='"&$str16&"' ,reservedel1='"&$str17&"' ,pris1='"&$str18&"' ,reservedel2='"&$str19&"' ,pris2='"&$str20&"' ,reservedel3='"&$str21&"' ,pris3='"&$str22&"' ,reservedel4='"&$str23&"' ,pris4='"&$str24&"' ,reservedel5='"&$str25&"' ,pris5='"&$str26&"' ,ialtprice='"&$str27&"' WHERE id='"&$id&"'") Else _SQLite_Exec($dbn,"INSERT INTO datas (id,modtager,timeanddate,navn,telefonnummer,email,indleveret,garanti,fakturanummer,color,brand,di versebeskrivelse,accesory,diversetlbhr,fejlbeskrivelse,antaltimer,reservedel1,pris1,reservedel2,pris 2,reservedel3,pris3,reservedel4,pris4,reservedel5,pris5,ialtprice) VALUES ('"&$str1&"','"&$str2&"','"&$str3&"','"&$str4&"','"&$str5&"','"&$str6&"','"&$str7&"','"&$str8&"','"&$str9&"','"&$str10&"','"&$str11&"','"&$str12&"','"&$str13&"','"&$str14&"','"&$str15&"','"&$str16&"','"&$str17&"','"&$str18&"','"&$str19&"');") EndIf As far as I see it, it's just two different ways of doing the same thing but am I missing something? - and in that case what? Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 12, 2009 Share Posted February 12, 2009 One does UPDATE, the other does INSERT. Look up those functions at the SQLite web site, or any other SQL reference to see the difference. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Edifice Posted February 12, 2009 Author Share Posted February 12, 2009 Yes I got that part. It's the way it's done I'm thinking of? Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 12, 2009 Share Posted February 12, 2009 Yes I got that part. It's the way it's done I'm thinking of?What...? A little early in the day to be that wobbly, isn't it? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
JRowe Posted February 12, 2009 Share Posted February 12, 2009 Update = change existing entry Insert = make new entry _SQLite_Exec simply takes a SQL query and executes it, after a SQLite database has been opened. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
Edifice Posted February 13, 2009 Author Share Posted February 13, 2009 Yes, I also follow that. But: One of the type has all the strings seperatly and one has them right after the location in the database. As I see it it makes no difference, and I was just wonderng whether it was important or not? Link to comment Share on other sites More sharing options...
BrettF Posted February 13, 2009 Share Posted February 13, 2009 (edited) Im under the understanding that if you specify where you want to place it, it will replace that- i.e INSERT INTO table (col,col,col) VALUES (value, value, value) Otherwise with update, it will set what you specify col=value etc. But as they are 2 DIFFERENT queries, I recommend you read up on them, all your questions should be answered just by searching for it Cheers, Brett Edited February 13, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Edifice Posted February 15, 2009 Author Share Posted February 15, 2009 Thanks! I get why there is a difference now - you just cleared it up in a single sentence Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now