Sign in to follow this  
Followers 0
ahmed9100

SQLite Q

3 posts in this topic

#1 ·  Posted (edited)

good day

where is my error here

this delete 2 or 3 filed i dont know why ?

Func datadel($ip)
    Local $retarr
    _SQLite_QuerySingleRow($dbn,"SELECT id FROM Network1 WHERE IP='"&$ip&"'",$retarr)
    If $retarr[0] <> "" Then
        _SQLite_Exec($dbn,"DELETE FROM Network1 WHERE id='"&$ip&"'")
    EndIf
EndFunc

i think this mean to select the id where the ip found right !

_SQLite_QuerySingleRow($dbn,"SELECT id FROM Network1 WHERE IP='"&$ip&"'",$retarr)

and this delete the Column right !

_SQLite_Exec($dbn,"DELETE FROM Network1 WHERE id='"&$ip&"'")

if im wrong some one tell me what is right ! :unsure:

Edited by ahmed9100

Share this post


Link to post
Share on other sites



hi ahmed9100,

_SQLite_QuerySingleRow($dbn,"SELECT id FROM Network1 WHERE IP='"&$ip&"'",$retarr)
This query does as you think. :unsure:

_SQLite_Exec($dbn,"DELETE FROM Network1 WHERE id='"&$ip&"'")
This one however, then deletes all rows from Network1 where the condition is met. ;)

Tip: To delete less rows (and/or gain more control over exactly which ones are deleted), make your condition more specific.

With respect to deleting columns read this.

Here's a nice SQL tutorial you may want to peruse at your leisure.

Hope this clears some things up :>

-smartee

Share this post


Link to post
Share on other sites

You're confusing Id and IP ! Look at the delete statement again: where id=...$ip

Now, you don't have to select first. Simply delete the row(s) with

"delete from network1 where ip = '"&$ip&"';"


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0