inserting server time into mysql

2006-05-09 Thread Alla-amin
Hi everyone,

I am trying to capture my server time automatically using php and insert it in 
a mysql table.

Can the timestamp or time data type capture this information automatically 
without having me code anything else?


Re: inserting server time into mysql

2006-05-09 Thread Alla-amin

Thanks for your help,

How can I capture this information from a php form into a mysql table. 
This is what I did:

1. I created the table and the user to access the database the table is in
create table staffs (
id int not null auto_increment primary key,
firstname varchar(20) not null,
lastname varchar(20) not null,
signin datetime not null
);

2. I created a php form to insert data into this table. The
form works but the datetime field isn't populated

html
head
titleStaff Detail/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head

body
?php
if(isset($_POST['add']))
{
include 'config.php';
include 'opendb.php';

$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$signin = $_POST['signin'];

$query = INSERT INTO staffs (firstname, lastname, signin) VALUES 
('$firstname', '$lastname', '$signin');
mysql_query($query) or die('Error, insert query failed');

include 'closedb.php';
echo New staff detail added;
}
else
{
?
form method=post
table width=400 border=0 cellspacing=1 cellpadding=2
tr
td width=100First Name/td
tdinput name=firstname type=text/td
/tr
tr
td width=100Last Name/td
tdinput name=lastname type=text/td
/tr
tr
td width=100Sign-In Time/td
tdinput name=signin type=text/td
/tr
tr
tr
td width=100nbsp;/td
tdnbsp;/td
/tr
tr
td width=100nbsp;/td
tdinput name=add type=submit id=add value=Submit/td
/tr
/table
/form
?php
}
?
/body
/html

Am I doing something wrong?

You mentioned that I can insert the now() function into a regular datetime 
field, how can I do that?


In the last episode (May 09), Alla-amin said:
 I am trying to capture my server time automatically using php and
 insert it in a mysql table.
 
 Can the timestamp or time data type capture this information
 automatically without having me code anything else?

You can use the 'timestamp' type to automatially insert the current
date/time when inserting or updating, or you can insert now() into a
regular 'datetime' field.

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-type-overview.html
http://dev.mysql.com/doc/refman/5.0/en/datetime.html
http://dev.mysql.com/doc/refman/5.0/en/timestamp-4-1.html


RE: inserting server time into mysql

2006-05-09 Thread Alla-amin
Thanks guys,

It worked - thank you all so very much.


Re: MAC OS X backup after crash

2005-06-29 Thread Alla-amin
Michael,

You are very correct - I renamed those fields and boom
- it started working like magic, thank you so much.

I have another question - the database in question
that got crashed had mysql root password but the guys
I took over from forgot the password and didn't do any
mysql dump. So, I had to manually copy the files i.e
MYD, MYI and frm files to the database directories
after creating them. However, the application that is
using the database requires a certain user account in
the mysql database and I can't get to it without the
password, so I had to replace my new server mysl
database files from the old server and it worked.
However - I can't administer the mysql server without
the root password. Anyone has any idea how I can
retrieve the root password?




__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MAC OS X backup after crash

2005-06-25 Thread Alla-amin
So far this was what I did,

Took all files i.e frm, MYI and MYD files from the new
server. Created a database like on another box running
the version of mysql the old server was running and
pasted them in the data folder of the database I
created and viola - they all showed up, so i think it
was a compatability issue.

Now - I don't want to un-install mysql on the new
server so I did a dump from the test server and tried
to import it but it encountered some errors on the way
and imported only 9 tables out of 14.

So, I dumped table by table and imported table by
table and was able to import 12 tables and found out
the tables that were giving problems. They are syntax
errors, however - I have been battling with them over
the past 8 hours, everything seems right to me and
they run on the old version of mysql I copied the frm,
MYD and MYI files to - but when I did a dump to the
same server on another database or the new server - it
gives the ff errors.


1. 

CREATE TABLE xrates (
  date date default NULL,
  time time NOT NULL default '00:00:00',
  amount_from decimal(15,5) NOT NULL default
'0.0',
  currency_from char(6) NOT NULL default '',
  amount_to decimal(15,5) NOT NULL default '0.0',
  currency_to char(6) NOT NULL default '',
  order tinyint(1) unsigned NOT NULL default '0',
  UNIQUE KEY date (date,currency_from,currency_to)
) TYPE=MyISAM;


MySQL says

ERROR 1064: You have an error in your SQL syntax near
'order tinyint(1) unsigned NOT NULL default '0',
  UNIQUE KEY date (date,currency' at line 8


2. 

CREATE TABLE user_log (
  id mediumint(8) NOT NULL auto_increment,
  number varchar(7) NOT NULL default '',
  when timestamp(14) NOT NULL,
  what varchar(255) NOT NULL default '',
  PRIMARY KEY  (id)
) TYPE=MyISAM;

MySQL says

ERROR 1064: You have an error in your SQL syntax near
'when timestamp(14) NOT NULL,
  what varchar(255) NOT NULL default '',
  PRIMARY ' at line 4


Plz assist.



__ 
Discover Yahoo! 
Find restaurants, movies, travel and more fun for the weekend. Check it out! 
http://discover.yahoo.com/weekend.html 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: MAC OS X backup after crash

2005-06-24 Thread Alla-amin
Yes, 10.1.5 runs mysqk version 3, it was actually
running 3.23.51 and 10.3 runs 4.0.14 I think. Ok - the
database in question have been backedup with files
such as
table1.frm.gz
table1.MYD.gz
table1.MYI.gz
and so on.gz

When I create a new database on the new server and
copy these files to the the new database, mysql
doesn't recognize them.

When I rename table1.frm to table1.frm and copy it to
the new server database - mysql says that there is no
data there.

I haven't tried this on a 10.1.5 system yet - will do
that asap.



Alex Dehaini
App Engineer
NAS GLOBAL NETWORKS
Mobile = +233-24-877231
Office = +233-217012800/2
Email = [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



MAC OS X backup after crash

2005-06-23 Thread Alla-amin
Hi everyone,

I just subscribed to the list and some of the articles
are very helpful. I'm facing some problem on my mysql
database server.

One of our Raid drives crashed and we had to backup
the whole data to another drive (only files), we did
no mysqldump. Now I want to restore a certain database
from the crashed drive to the new server. I compressed
it and uncompressed it in the data folder of the new
server but the server only sees the database but no
info.

The 1st dbase was on MAC 10.1.5 and the current one is
one 10.3. Any help please.

Alex

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]