Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Perl And Mysql Datetime


I am trying to have an update form for a datetime field. I've been looking all morning and haven't been able to find any examples of how to do it.
I have the date in the form formatted by perl like this: 08-14-2006 11:29:28 and when I do the update to mysql nothing happens. It does not work.
I need to make it so the user can put the time the student left.




View Complete Forum Thread with Replies

Related Forum Messages:
MySQL, Perl CGI
I'm developing a simple computer helpdesk system with MySQL as the
backend and Apache/CGI/Perl as the user interface. I've sucessfully
set up the part where a user enters an issue via HTML form and
"submits" it to the MySQL database. My question is: I have it set up
where the user posts the issue to the database, the database
auto_increments an issue_id number field. How do I return that
issue_id number back to Apache so that the user can see it (and use it
as a reference number)?

View Replies !
Perl-DBD-MySQL
I have a binary distribution of MySQL 4.0.20 installed in
/usr/local/mysql.
Therefore, the only libmysqlclient file I have is libmysqlclient.a
(static library).
And also, Perl:DBI already installed.

I'm trying to install perl-DBD-MySQL-2.9004 from source.
What should I add to 'perl Makefile.PL' as arguments to make sure it
finds the
static library?

I've tried 'perl Makefile.PL
--libs=/usr/local/mysql/lib/libmysqlclient.a and gotten
this:

---------------------------------

[root@localhost DBD-mysql-2.9004]# perl Makefile.PL
--libs=/usr/local/mysql/lib/lib/mysqlclient.a
I will use the following settings for compiling and testing:

cflags (mysql_config) = -I/usr/include -mcpu=pentiumpro
libs (Users choice) =
/usr/local/mysql/lib/lib/mysqlclient.a
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
ssl (guessed ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testuser (default ) =

To change these settings, see 'perl Makefile.PL --help' and
'perldoc INSTALL'.

Unrecognized argument in LIBS ignored:
'/usr/local/mysql/lib/lib/mysqlclient.a'
Using DBI 1.30 installed in
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/auto/DBI
Writing Makefile for DBD::mysql
[root@localhost DBD-mysql-2.9004]#
---------------------------------
What should I do to get DBD-MySQL to install correctly?

View Replies !
Using Perl With Mysql
I have heard that if you want a view with mysql, perl is one iof the best applications to use. I want to make a user interface with perl that will prompt the user to enter values and then those values will be stored into the database. I'm just started to learn how to use perl, can anyone give me a little help with writing the code?

View Replies !
Perl DBD::mysql - Using Arrayref
I have an app where I would like to display a returned table with column
headings as specified in the inquiry (select), while preserving the
column sequence of columns as specified in the original inquiry -
without having access to the original inquiry.

If I use the fetchrow_hashref method, I can determine the column
headings, but I lose the sequence. If I use fetchrow_arrayref, I
preserve the sequence, but I lose the column headings. I suspect there
is an easy answer. Anybody have it?

View Replies !
Dealing With Mysql Through Perl
i'm working with a mySql database. i have accessed the database through perl.
now i want to know how i can store images in the databases through perl and how to retrieve it..
does anyone have an idea abt this?

View Replies !
Perl And Mysql 5, Can't Connect
I have installed perl 5.8.8 and mysql 5. My perl scripts don't work with mysql.
Do I need to do something more for perl and mysql 5 to work together?

View Replies !
Perl/mysql On Linux
i am not getting the output for the following code (given below) in apache server on linux.
but i do get ouput in perl interpreter please replay me .
vinaykumarms@rediffmail.com





#!/usr/bin/perl
print "ContentType: text/plain

";

use DBI;

# Connecting to the database
# Replace DATABASENAME with the name of the database,
# HOSTNAME with the hostname/ip address of the MySQL server.
$drh = DBI->install_driver("mysql");
$dsn = "DBI:mysql:database=vinay;host=localhost";
$dbh = DBI->connect($dsn,"","");

# Select the data and display to the browser

my $sth = $dbh->prepare("SELECT * FROM login");
$sth->execute();
while (my $ref = $sth->fetchrow_hashref()) {
print "Found a row: id = $ref->{'id'}, name = $ref->{'name'}
";
}

$sth->finish();

# Disconnect from the database.

$dbh->disconnect();

View Replies !
Verifying Mysql Writes (perl)
What is a proper way of verifying that a mysql write was successfull,
and to retry if it wasnt?

In my perl script I add records through:

my $dbh=DBI->connect($dsn, $db_user_name, $db_password);
my $sth=$dbh->prepare("insert into TABLE (X, Y, Z) values ('1', '2',
'3')");
$sth->execute;
$sth->finish;

I have noticed that from time to time this fails, due to limitations
of my webhost. I thus want to do a check after the write, that it
actually happened, and if not redo.

View Replies !
Unable To Connect To Mysql Via Perl
I am attempting to connect to my mysql using a perl script, and keep getting an error message that tells me the I am missing a sub routine.

I have installed DBI and DBD::mysql but still can not use

my $dbh = open_dbi($db,$username,$password)

I am assuming that open_dbi is not installed, does anyone know of another, or better way to access mysql via perl.

View Replies !
Installing MySQL 5 Perl DBI Must Be Installed?
the steps to installing MySQL 5 on Red Hat Linux 9? When I follow the steps as outlined in the manual or Red Hat text I get an error that Perl DBI must be installed.

After attempting to download the Perl DBI; that failed because the server was not availabe. Eventually I was able to download some Perl stuff, but not the DBI. Here is the problem at its root. Where is the information to handle all of the error messages? Where is the source of knowledge to work around these problems?

View Replies !
MySql Coding In Perl Manual
Can anyone point me to a good online (or downloadable) manual on MySql coding in Perl?

View Replies !
Retreiving MySql Data With Perl (DBI)
I have been trying to retrive data out of MySql data file using DBI and Perl for a while with no luck. I get message "Can't locate loadable object for module DBI in @INC (@INC contains: C:/Program Files/Perl/lib C:/Program Files/Perl/site/lib .) at C:/Program Files/Perl/lib/DBI.pm line 258"

I have DBI.pm in above respected directories. I have no problem retreiving data out of flat files ie simple text file with delimiters. I use windows xp,Perl,Apache server and MySql server at home with no other problems.

View Replies !
MySQL/Perl Book Recommendation For A Beginner?
Here's the situation: I have a Perl-based forum that I wrote myself. It
currently supports user accounts, but these are stored in a flat text file
(as is everything else for that matter). I'm looking to convert this to a
MySQL database so that I can do more with that information, but with less
processing time (reading through that huge text file to find something isn't
very efficient).

In the future I hope to move the whole forum over to MySQL, but I thought a
good starter project would be just one aspect of it.

At this point I am looking for recommendations on good books for someone
moderately experienced with Perl, but who has NO experience with MySQL or
anything similar. Since I'd prefer to integrate this with my existing
script, I'd rather stick with Perl and not learn PHP at this time. So far it
seems like "MySQL and Perl for the Web" is a good - are there others? I
prefer reference-style texts with useful code examples, rather than
lesson-style books.

View Replies !
Calling MySql Select Procedures In Perl
I am trying to call a "select" stored procedure from perl. I am not quite sure how to do it. Here is the stored procedure:

CREATE PROCEDURE spTest() begin select x AS X from tblTest;

It works fine when called from within MySQL.

mysql> call spTest():
+------+
| X |
+------+
| 24 |
| 3 |
+------+

I have the following code in perl:

my $spt = $db->prepare("Call spTest()");
$spt->execute();
$spt->bind_columns($id);
while($spt->fetchrow_array()){
print "X = $id";
}

I get an error that says I need to use "select into". How do I call this procedure from perl?

View Replies !
Compare Datetime Field With Todays Datetime
How do I compare a datetime field in the database with todays datetime...

Is it:

if rs("fieldname")<>getdate() then
....
else
(gotto set a cookie here)
end if

Somebody suggested I use cdate...what is tht for..is it to make sure they are both in the same format or something.. if so how do I use it?

View Replies !
MySQL Datetime
I'm trying to set up an RSS 2.0 feed and in order for it to be vaild I need to convert a datetime column in my database to an RFC-822 date-time (Wed, 02 Oct 2002 08:00:00 EST).

I'm using the following SQL, but am returning NULL in the date_format column from the query:

SELECT article_id AS id, article_title AS title, article_deck AS deck, DATE_FORMAT( 'article_date_added', '%a, %d %b %Y %T' ) AS date_format
FROM article
WHERE article_id =24 LIMIT 0 , 30

View Replies !
DateTime Format In MySQL
i have datetime format in mysql database table. now,
in mysql date is YYYY-MM-DD format. how can i insert date in this
format with VB Script ? i had tried following

dim dt, dy, dm, dd, pd, tm
tm = Time
dt = Date
dy = DatePart("YYYY",dt)
dm = DatePart("M",dt)
dd = DatePart("D", dt)

pd = dy & "-" & dm & "-" & dd & " " tm

this shows correct datetime, but doesn't insert in database table. it
gives error: incorrect format.

View Replies !
Mysql Datetime Columns
I've been storing my times in an integer field as unix timestamps. I'm thinking about making the switch to mysql's date/time column types instead but I have a question.I do a lot of comparing with dates and was wondering if using mysql's date/time column types will slow down my queries since it has to convert the column to an "internal long integer" to do a comparison rather than not just comparing straight integers with a unix timestamp in an integer column.

source: http://dev.mysql.com/doc/refman/5.0/en/using-date.html
Quote: Originally Posted by mysql.com When you compare a DATE, TIME, DATETIME, or TIMESTAMP to a constant string with the <, <=, =, >=, >, or BETWEEN operators, MySQL normally converts the string to an internal long integer for faster comparision (and also for a bit more “relaxed” string checking).

View Replies !
Unixtimestamp Or Datetime From Mysql?
i'am designing a database and one question occurs evertime i need a time attribute: should i use int with unixtimestamps or the mysql datetime? my associate says unixtime stamp is far better when it comes to calculations with time.

on the other hand i read something about new functions in mysql 4.1.1. relating date and time. do i need unixtime anymore for any calculations if i would use mysql 4.1.1.?

View Replies !
MySQL Datetime DataType
I'm just trying to insert a datetime value into mysql datetime feild, but everytime run the script, and then look in the data base all i see is 0000-00-00 00:00:00

sql= "INSERT INTO ForumPosts (PostDate) VALUES ('" & NOW() & "')"
set rs= MyConn.execute(sql)
set sql= nothing

View Replies !
MySQL Select By Datetime?
Just moving my web site ( in ASP ) over to MySQL from Access,

and I'm having trouble with this query:

strsql ="select count(*) from transactions where transactions.BAdateStamper between #" & theMonth & "/" & i & "/" & theYear & " 00:00:01# and #" & theMonth & "/" & i & "/" & theYear & " 23:59:59# and active=1"

was hoping that someone might know what I'm going wrong here,

View Replies !
Perl DBI / SQL
I need to know how to retrieve through Perl DBI a listing of possible ENUM
elements from a field for processing under a CGI script. If all I need for
this is some form of SELECT statement, please provide a code snippet of this
so I can do it.

I want to make my code so I'm not having to edit hard-coded Perl CGI scripts
if/when I add new elements to the ENUM field.

View Replies !
PHP Or Perl?
As part of my own learning mysql project I'm planning to build
databases for all my books and DVD's. Stephen Hawking is probably
a better typist than I am so I plan to use barcodes to get the info
,taking the information from various web sites.

People tell me that PHP is THE way to do database work with mysql.
The thing is, I'm familiar with Perl and it has all kinds of neat
string manipulation stuff and LWP.

Does PHP have comprable libraries (especially LWP) and how difficult
is it to move from Perl.

View Replies !
Fw: PHP Or Perl?
Do've an example on using Rebol to connect to mySQL via TCP/IP?
How do you do it? How do you execute SQL quieries? Return results etc ?
Do you use some kind of "middleware" that your communicating to from Rebol
via TCP/IP which gets the data for you?I'm actually a Delphi, Java, VB, Perl & Ruby developer (done alittle Rebol
before) but found it strange that your using TCP/IP to communicate with
mySQL



View Replies !
MySQL Select Datetime Less Than Or Equal To
I am using MySQL 4.0.18 and I have a field named "order_datetime" in
which I store data in the format 20041001 23:00:00 (for example Oct 1,
2004 11pm)

When I do a select statement to find dates in a given range, the
result set never includes records that have the ending date. For
example, if my SQL statement is

Select * from HH_Will_Call where (order_datetime >= (20041001) and
order_datetime <= (20041003)) order by order_datetime

It will only include records through Oct 2, even though I know there
are records in the table that have Oct 3!

As you can see, I am using the less than or equal to operator, yet I
have this problem with any date range. How can I get the ending date
to be included?

View Replies !
DATETIME Field Conversion In Mysql
I know that there is a function in MYSQL to define a 'datetime' type column but when I am migrating a foxpro database to MYSQL type and when foxpro has the datetime column in the format: "08/12/1999 09:39:00", how would I convert this to mysql format while I am trying to load the data in the database(using LOAD command).

I have used str_to_date functions in the past to convert the date formats between the two databases but how do we go about the datetime format.

View Replies !
Mysql Select Based On Datetime
I am having an issue returning a known record based on a date field that is of datetime format from mysql.

the data looks like this in mysql: 2006-01-26 20:01:45
here is the eror I receive:
SQL error=You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near &#3920;:01:45' at line 1

this is the select statement I am using

("SELECT selections from your_show WHERE userid = $userid and date = ".rawurldecode($date)." ");
$date is passed as 2006-01-26%2020:01:45


View Replies !
Select Via Perl
I am trying to read a file and see if the contents of it exists in the DB or not and am trying to do it via a Select.I try to do a select * into outfile /tmp/result.txt from table where field like "%$var%"; but it always goes through the first two lines of the input file and then says the file already exists. Is this because I read each line of a file in a for loop in perl and the mysql query tries to recreate the outfile each time? Is there any other way I can dump the results of the select to a file of some sort?

View Replies !
PHP Or Perl? (or Rebol Via TCP/IP)
Do've an example on using Rebol to connect to mySQL via TCP/IP?

How do you do it? How do you execute SQL quieries? Return results etc ?
Do you use some kind of "middleware" that your communicating to from Rebol
via TCP/IP which gets the data for you?

I'm actually a Delphi, Java, VB, Perl & Ruby developer (done alittle Rebol
before) but found it strange that your using TCP/IP to communicate with
mySQL.

View Replies !
Error In Perl
I receive the following error when I try to acces MySQL 4.1

Client does not support authentication protocol requested by server; consider upgrading MySQL client

I conntect with Perl in this way : $dbh = DBI->connect("DBI:mysql:dbname:localhost","dbuser","dbpass") or print"I can't connect" .DBI->errstr;;

View Replies !
Uninstall Perl (DBI)
i try to install Mysql Server V5 on a Redhat 5 Enterprise.

But the RPM needs Perl (DBI) so I install it following the install guide provide on this site. But it' seems to not be detected by the rpm package when installed.

View Replies !
Perl Dbi And Bitfields
In the past I encoded some bit fields into hex and stored them in a short string. I now want to be able to use sql to select records according to settings of various 'flags'. So I have changed the field to a bit field and have succeded in populating it.

I can display the vaules using bin(flags+0) as a string of 1 & 0s but when I try to get the value back into a perl variable from a select * it always comes back as 0?

View Replies !
Can't Get Perl To Connect
I am just trying to connect and it wont give real errors like PHP it just says internal server error.

#!/usr/bin/perl
use warnings;
use strict;
use DBI;

$dsn = 'dbi:mysql:dbname=Location_Test';
$user = 'lmayer';
$password = '*******';
$dbh = DBI->connect($dsn, $user, $password,
{ RaiseError => 1, AutoCommit => 0 })

I can't make this work at all. I know its configured correctly since all the other pages work. I connect fine at the command line so I know the username and password work.

View Replies !
Perl Script
Is it possible to have MySQL execute a Perl script? I need to run the script upon insertion of a row into a MySQL table.
I've seen myperl, but that appears to execute Perl syntax from within MySQL and won't meet our needs

View Replies !
What Is The NOW() Function In A MySQL DateTime Field Query?
I have a monitoring script which I am trying to better understand. One of the queries is built as follows: .....

View Replies !
How To Upload Images With Perl
I want to upload an image from a form, store it in the db, then retrieve it and display it on an HTML page. I am looking for a Perl code example to do the store and retrieve.

View Replies !
Getting Last Auto Increment ID (perl DBI)
i am inserting a new line into a table with an auto incremented unique ID. after that i want to add a row to another table that will cross reference with using the ID from the first.

what is a reliable method of performing this? selecting the highest ID is open to possible race errors so i'm not keen to do it that way. can it be done in one line?

View Replies !
Authentication Failing In Perl DBI Script
#! /usr/bin/perl

use DBI ;
use strict ;

use CGI ;
my ($cgi) = new CGI ;

my ($dsn)="DBI:mysql:dr:localhost";
my ($user_name) = "fubar" ;
my ($password) = "secret" ;
my ($dbh,$sth) ;
my (@ary) ;

$dbh = DBI->connect ($dsn, $user_name, $password, { RaiseError => 1 });

, and on MySQL, at the command prompt, I've typed this:

grant all on *.* to fubar identified by "secret" ;

View Replies !
Blob Update In Perl DBI Gives Syntax Error
I have a Perl app that stores pictures in a blob. Now I want to load a thumbnail version of the picture into another blob column, but the update fails with a syntax error. I'm able to insert the new record, with blobs, into a separate table, but can't update the original record. Is it not
possible to update blobs?

View Replies !
LOAD DATA LOCAL INFILE And Perl DBI/DBD
For the past several months we have been using LOAD DATA LOCAL INFILE to bulk load tables within
Perl modules.

Recently, someone thought it would be a good idea to upgrade the Solaris machines - I'm thinking it
wasn't that good an idea :-(

We are now running MySQL 4.0.18 and the DBI version is 1.35. Now, our scripts are failing with the
dreaded "The used command is not allowed with this MySQL version" message. Here's what I know at
the moment:

1. mysqld has local infile enabled.
2. mysql client can perform a LOAD DATA LOCAL INFILE
3. dbimon cannot perform a LOAD DATA LOCAL INFILE (same message as above).

So as I understand this, DBI is somehow not allowing the local option. I tried adding the
local_infile=1 option on the DSN, but that didn't help (if there was an error, it was silently
ignored).

Two questions:
1. How can I get the LOCAL option working?
2. How can I identify the source of the problem better so we don't waste more time in the future?

View Replies !
Insert Data Into Database Using Perl Script
how to insert data into my sql using perl script??

View Replies !
Question On Selecting From A Large Table In Perl
I have a large table with 4 million rows. I need to do an operation on each of the rows. I am using Perl.

When I use the following code on a small table, it works just fine but on the large table, it gets stuck on line 3. As soon as it executes line 3, my hard drive starts going and keeps on going with no end. It never reaches line 4. My diagnosis follows the code fragment below:

-------------------------------------code fragment begin
1 my $sql = 'select myColumn from myTable';
2 my $sth = $dbh->prepare($sql) || die ("dbh prepare failed ");
3 $sth->execute() || die ("execute sth failed");
4 my $colValue;
5 $sth->bind_columns($colValue);
6 while ($sth->fetch()) {
7 do something to $colValue;
8 }
-------------------------------------code fragment end

I think this is because mySQL is trying to load all 4 million rows into memory. Is there a way, perhaps a command line switch, to delay this so that it processes one row at a time. I have tried adding SQL_NO_CACHE to my SELECT statement but that did not make any difference at all.

On a related note, when I was trying to export the four million rows using mysql command line, I had a similar problem but I found the -q command line switch for mysql command line (From the manual: -q or --quick means "Don't cache result, print it row by row.")

I hope there is something similar for my Perl problem above too. Or am I doing something completely wrong in the way I am doing this? I am a newbie to mySQL.

View Replies !
How To Generate Html Output For Query Result With Perl
I can generate the html with the command like:

>mysql -ppassword -uusername -H -e "select distinct depID from tabledepart" databasename

but i need to know how to generate html output if i already connected with a database, and how to pass the html result to the perl program.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved