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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Re: DBD::mysql trouble by graff
in thread DBD::mysql trouble by vendion

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found