From: Douglas Brantz Date: March 21 1999 8:43pm Subject: Timestamp or Datetime? List-Archive: http://lists.mysql.com/mysql/735 Message-Id: <36F559DB.817F52EA@appstate.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sasha, I am trying to create an inventory database and want to keep track of the date and time of the inventory. Should I use timestamp or timedate? I am trying both, but I can't seem to get any variables in the timedate field, is that because I have timestamp as a field above it? Can you have both Timestamp and timedate in a table? I would also like to write out my time statement in a web form ticket. Do you know how I can get the curmonth(d),curdate(d),curtime(d) from table? d=timestamp But I have all this other data I am selecting out of the table first. can I just add another select statement at the end? and then how would I display this in a web page? Example: my $dbh = Mysql->connect("redhat.appstate.edu", "test"); my $command=""; $command = "select formnum,coll,dept,build,comp,os,"; $command .= "ident,classi,fas,hwa,ip,cont,bios,speed,ram,drive,"; $command .= "nic,vid,printer,firstn,lastn,phone,email,patch,room,"; $command .= "sr2,client32,virus,corel,"; $command .= "y2kapps,y2kpass,rate,tester,info,d from y2k "; $command .= "where dept LIKE \"\%$dept\%\" "; $command .= "AND build LIKE \"\%$build\%\" "; $command .= "AND comp LIKE \"\%$comp\%\" AND os LIKE \"\%$os\%\" "; $command .= "AND formnum LIKE \"\%$formnum\%\" "; $command .= "AND fas LIKE \"\%$fas\%\" AND lastn LIKE \"\%$lastn\%\" "; $command .= "AND rate LIKE \"\%$rate\%\" "; $command .= "order by \"$order\""; d is the last variable and is the timestamp, if I add another select statement to get the curday,curmonth,curdate,curtime from d how do I make it a variable to display back to the user on a web page.? can I add a select statement at $command .= "select curday(d) etc. before the where part of the code? Thanks, Douglas Sasha Pachev wrote: > Douglas Brantz wrote: > > > > Hello, > > > > newbie here, > > > > I am running Mysql 3.22.15 on Redhat 5.2 and am really enjoying mysql. > > Anyway, > > my question is this: I have to test database that I have been building > > all my tables in and everything works great adding data through a web > > form. Now, when I create a new database by going to mysql and then > > create database 'name' I can create tables, but I can't place the data > > in the new database tables with a web form. Are there a set of rights > > that I have to create for writing to the new databases? I also logged > > in as root when I created these new databases. It's not too big a deal, > > but I just get tired of not understanding why my forms contain no data > > with these new databases and then I resort to building more tables in > > the default test database which seems to work. Should I create the the > > database in a normal user mode, and am I having this problem because I > > don't have rights to add data? It seems that I can add data and select > > and show data with the new database tables from the mysql command line > > with no problems. > > > > Data Question? I am using Timestamp and would like to splash back on a > > web page the Month, day, year, time. with other data. Do I need to > > write in a sub select statement to select the curdate(),curtime, etc. > > Do I need to assign a variable to display it? $TD=curdat(),curtime() > > from 'table' where X=Y? How many calls to the database can you make and > > do you need sub select statments if you make more than one call to the > > database? > > > > Count Question? I would also like to count the number of fetchrows are > > returned from a search and place that number at the top of the page, > > Number of queries are X. Is there an easy way to go about this. > > > > I am checking the manual as well, so I might find the answers, but any > > help would be greatly appreciated. > > MYSQL has its own access privilige system that is independent of Unix. > Access policies are defined by the three tables in the database with the > name of mysql. You can read more about this in the manual, it explains > it quite well. > > -- > Sasha Pachev > http://www.sashanet.com