ahmed9100 Posted May 7, 2011 Share Posted May 7, 2011 (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 ! Edited May 7, 2011 by ahmed9100 Link to comment Share on other sites More sharing options...
smartee Posted May 7, 2011 Share Posted May 7, 2011 hi ahmed9100,_SQLite_QuerySingleRow($dbn,"SELECT id FROM Network1 WHERE IP='"&$ip&"'",$retarr)This query does as you think. _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 Link to comment Share on other sites More sharing options...
jchd Posted May 7, 2011 Share Posted May 7, 2011 You're confusing Id and IP ! Look at the delete statement again: where id=...$ipNow, 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 hereRegExp tutorial: enough to get startedPCRE 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) 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