Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: DBD::mysql trouble

by graff (Chancellor)
on Sep 23, 2009 at 01:15 UTC ( [id://796862]=note: print w/replies, xml ) Need Help??


in reply to DBD::mysql trouble

As others have suggested, life will be better for you when you use an array for field names, a hash for field values (keyed by the names in the array), placeholders in your sql statements, and loops to keep everything compact and non-repetitive.

Once you are enjoying the beauty of all that, you'll really want to get acquainted with a cross-platform GUI library, especially for this sort of application. It's just much nicer for a user to fill in fields in a form, and have the ability to review all the values for a record (and maybe fix one or two of them) before submitting the complete record to the database with the click of a button. Take your pick of Tk, Wx, Qt or Gtk. Even Curses would be better than your current approach.

The worst torture I can imagine for someone doing keyboard entry to a database is having to use the OP's style of irreversible, "one-field-at-a-time" sequential dialog. The likelihood of making a mistake that requires a complete start-over is so high that actually completing a single record entry becomes a daunting and maddening task.

You can find a lot of self-contained sample GUI programs here at the Monastery that use most of the libraries cited above; also, a lot of the libraries come with very nice demo programs that show you how things work, and how the code is written to do those things.

Replies are listed 'Best First'.
Re^2: DBD::mysql trouble
by vendion (Scribe) on Sep 23, 2009 at 16:43 UTC

    I'll keep the UI idea in mind for latter, right now I want to get the core functionality working first them move on to making it look good. Its not to bad considering only 2 people are going to use the program and we don't mind inserting values one at a time for now.

      Then I highly recommend Term::Interact because it will keep prompting until you enter valid input
      Computer Information ----------------------- Customer First Name: () Customer First Name: (ha ha) Customer First Name: Bob Customer Last Name: )()( Customer Last Name: Ricky Customer Phone #: ))) Customer Phone #: Caught a SIGINT at C:/perl/site/5.10.1/lib/Term/I +nteract.pm line 1138

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://796862]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-24 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found