This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mysql table read

Old posts that have not been replied to for several years.
Locked
a
asmds
Voice
Posts: 1
Joined: Sat Jul 30, 2005 5:19 pm

mysql table read

Post by asmds »

Hi all

Im trying to understand mysql and tcl because i want to do a script that uses a database, but i need some help.

first : i want that my eggdrop reads from a database when a user join my channel to see if that user is registered in a website that i run, if the user is not registered the bot will ban him and ask the user to do the registration.

I know how to do the basic TCL for this script, i just cant do the mysql part.

can you give me an example of the code to see +/- how to do it ? what do i need to run mysql ? mysqltcl only ?

the table is small, the fields are

Code: Select all

  `id` mediumint(8) NOT NULL default '0',
  `name` varchar(255) NOT NULL default '',
  `mgroup` smallint(3) NOT NULL default '0',
  `password` varchar(32) NOT NULL default '',

Thanks
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

did you go here already? if not, do so
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

what do i need to run mysql ? mysqltcl only ?
You need a mysql server, like the one from your site. (The data doesn't come from a blackhole :D ) And you need mysqltcl. You can talk to the server using the mysqltcl in your tcl script.

Once you got that create a query that gets the user data from the database like

Code: Select all

SELECT * FROM users WHERE username='$nick'
Then you can read the data and decide if the person can stay or not.
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

besides the popular among this community mysql.mod module and mysqltcl APIs, there's third option for using SQL database with eggdrop: SQLite, small & fast database engine with Tcl interface
G
Galadhrim
Op
Posts: 123
Joined: Fri Apr 11, 2003 8:38 am
Location: Netherlands, Enschede

Post by Galadhrim »

indeed, with that you dont need a separate mysql database server, since the package is the server.
Locked