May20
Here is an example of how you would select data based on a regular expression.
SELECT phone FROM table WHERE phone REGEX '^[0-9 ]{11,14}$' = 0 LIMIT 100
The above would show all the phone numbers that are not between 11 and 14 numbers and spaces.
SELECT phone FROM table WHERE phone REGEX '^[0-9 ]{11,14}$' LIMIT 100
The above would show all the phone numbers that are between 11 and 14 numbers and spaces.
I hope this quick guide has helped.
Any questions, feel free to ask.
Sep14
So, lately i’ve been playing around with tcl again, and trying to make it work alongside MySQL to store information such as Q auth’s and various other information on users. Its working quite well.
We connect to MySQL through TCL using a package called mysqltcl.
Here is how I connect:
# First we require the mysqltcl package. You normally have to install this.
package require mysqltcl
set db [::mysql::connect -host localhost -user username -password password -db database];
# Then perform an query...
# JOIN
#
bind join - * rec:join
proc rec:join {nick uhost hand chan} {
global botnick db
if {$nick == $botnick} { return 0 }
set result [::mysql::exec $db "INSERT INTO nicks (timestamp,channel,nickname) VALUES(UNIX_TIMESTAMP(),'$chan','$nick')"]
}
As you can see, in my example we store the nickname and channel when someone joins a channel your bot is sitting in. A very useful module indeed.