egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mysql: adding to a database
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Thu Apr 08, 2004 4:25 pm    Post subject: Reply with quote

do not set the field to date time set it to decimal or int
_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
SmokeyOne
Halfop


Joined: 14 Jan 2003
Posts: 69

PostPosted: Thu Apr 08, 2004 6:57 pm    Post subject: Reply with quote

okay I got it setup working with adding, now I have to see if I can get delete working, and then the searching funtion.

now with the serach i can just use -limit 10 for it to display the first 10 results, but then would it be better to use a switch or, a else if statment to use for another string ? like !list 99 or something ?
Back to top
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Fri Apr 09, 2004 12:05 am    Post subject: Reply with quote

Limit is a mysql statement right then hmm u need to check the Mysql reference also if your making a search script also check LIKE
_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
SmokeyOne
Halfop


Joined: 14 Jan 2003
Posts: 69

PostPosted: Fri Apr 09, 2004 6:44 pm    Post subject: Reply with quote

okay I can list the db somewhat, though I would like to create a header and a footer, seems that might be the only way... also i tired to split it up in 3 ways like Ttle: Data: Date:, and I justed [join [lrange $qurey 1]] but it says its needs a end, i don't remember how to stop it at just that filed so i can display the date information on another line..
Back to top
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Sat Apr 10, 2004 5:31 am    Post subject: Reply with quote

split up the date just use one string like unix time and use clock format unix time is all decimal chars and u can use it in php as well if you wana use webbased [censored] afterwards unixtime is almost reconized in any code so you can format anything from that way beter then spliting dates and [censored]

But this is totaly up to you
_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
SmokeyOne
Halfop


Joined: 14 Jan 2003
Posts: 69

PostPosted: Sat Apr 10, 2004 10:49 pm    Post subject: Reply with quote

okay well it works somewhat... now if I can get the header and the footer to display once, then show the list.... that's the problem I tried a older method, but it started to give me tcl errors.
Back to top
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Sun Apr 11, 2004 12:55 pm    Post subject: Reply with quote

what header i mean header of what ? .. what do you mean

hmm normal

Quote:
puts header

while ...
puts list ...
close ...

puts footer

_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
SmokeyOne
Halfop


Joined: 14 Jan 2003
Posts: 69

PostPosted: Thu Jun 24, 2004 2:30 pm    Post subject: Reply with quote

its been awhile since I was last on the net... my net time is starting to get smaller and smaller.. well anyways.. I beleive what I meant as a header and footer was.

New releases by Blah
1.
2.
3.
4.
checks us out on the web at http://www.blah.com

instead it was doing the top and bottom half over and over with each posting of the list.
Back to top
View user's profile Send private message
Ofloo
Owner


Joined: 13 May 2003
Posts: 953
Location: Belguim

PostPosted: Tue Jul 06, 2004 12:00 am    Post subject: Reply with quote

could u xplain what that is supposed to be ? and how did u make the country thing looks kinda cool was looking for something like it for my website tnx in advance
_________________
XplaiN but think of me as stupid
Back to top
View user's profile Send private message Visit poster's website
SmokeyOne
Halfop


Joined: 14 Jan 2003
Posts: 69

PostPosted: Sun Nov 07, 2004 6:57 pm    Post subject: Back At it again Reply with quote

after putting this stupid thing down for months, I'm trying again. Now from all my prvious posts I'm trying to retrive information and add information into a mysql database. using pub commands, my old code looks like this, someone let me know wtf I'm doing wrong here.
Code:
#Adding Routine
proc add:pub {nick uhost handle channel arg} {
   global mysql net
   set arg [rls:filter $arg]
   set table $mysql(release_table)
   set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
   mysqluse $sql(conn) $mysql(data)
   mysqlexec $sql(conn) "INSERT INTO '$table' ( 'id' , 'release_data' , 'release_date' ) VALUES ( '', $arg' , NOW( ))"
   mysqlclose $sql(conn)
   pustserv "NOTICE $nick :Release has been added"
   putcmdlog "<<$nick>> !$handle! Added a new Release to the database."
}
#Deleting Routine
bind pub - !del del:pub
proc del:pub {nick uhost handle channel arg} {
   global mysql net
   set table $mysql(release_table)
   set id ""
   set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
   mysqluse $sql(conn) $mysq(data)
   if {[string is integer $arg]} {
      set id [lindex [lindex [mysqlsel $sql(conn) "SELECT * FROM `$table` ORDER BY id ASC LIMIT [expr $arg -1],1;" -list] 0] 0]
      } elseif {[lindex $arg 0] == "-id" && [string is integer [lindex $arg 1]]} {
         set id [lindex $arg 1]
      }
      if {$id != ""} { set result [mysqlexec $sql(conn) "DELETE FROM `$table` WHERE `id` = '$id'"] }
      mysqlclose $sql(conn)
      if {$result != 0} {
         putserv "PRIVMSG $channel :Release has been deleted"
         putcmdlog "<<$nick>> !$handle! Deleted a Release in $channel."
      } else {putserv "PRIVMSG $channel :No such Release in database"}
   }


now i'm also trying to add a search string to allow to search for more than 10 but i also only want displayed the first 10 releases. here is that code

Code:
proc rls_show {nick uhost hand chan arg} {
   global mysql net
   set sql(conn) [mysqlconnect -host $mysql(host) -user $mysql(user) -password $mysql(pass)]
   mysqluse $sql(conn)
   mysqlsel $mysql(data) "SELECT id, release_data, release_date FROM $mysql(table)" -list
   putserv "PRIVMSG $nick :The Following is the 10 Newest Releases by \002blah\002"
   putserv "PRIVMSG $nick :Title:$release_data Date:$release_date"
   putserv "PRIVMSG $nick :TO search for more releases use !new #, or !new all"


I need to know what I'm doing wrong so I can start to fix this stupid problem. I'm open to all suggestions you have.. thanks


Also on the announcing part of the serach I get each line over and over like this
blah blah bhla
1.
blah blah blah
blahblahblah
2.
blah blah blha

instead of
blah blah blah
1.
2.
3.
blha blha blha

Thanks for any help


Smokey[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber