Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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?

Posted (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 by BrettF

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...