Happy Hollidays Perlmonks, I have a question with regards to MYSQL Databases. Currently, I am writing, editing, and pulling data from a pipe-delim "Flat-File" using cgi scripts. I would like to move the data over to a MYSQL DB and access them through the CGI scripts, of course with modifications. Does anyone have any suggestions or examples of CGI scripts that accomplish this? Here's a quick example of one of the scripts that I'd like to move to a MYSQL DB:
open (ORGDB,"<$database");
@ODB=<ORGDB>;
close (ORGDB);
open (DATABASE,">$database");
@DB=<DATABASE>;
foreach $rec (@ODB){
chomp($rec);
($agent_name,$agent_phone,$agent_cell,$agent_email)=split(/\|/
+,$rec);
if ($agent_name eq $input{'nagent_name'} && $agent_phone eq $i
+nput{'nagent_phone'} ){
print DATABASE "$input{'agent_name'}|$input{'agent_phone'}|$in
+put{'agent_cell'}|$input{'agent_email'}|\n";
}else{
print DATABASE "$agent_name|$agent_phone|$agent_cell|$agent_em
+ail|\n";
}
}
close (DATABASE);
Thanks for any suggestions or help!~ Lis
2004-11-27 Edited by Arunbear: Changed title from 'MYSQL Question', as per Monastery guidelines
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.