Dear Monks
Yesterday I post a question regarding a problem in my code when I try to do an Insert
This is the link to last post
The help was good but I still can't understand it, and well did not run as well.
The original code was like this :
my $dbhX1 = DBI->connect('dbi:XBase(RaiseError=1):');
my $select1 = $dbhX1->prepare("SELECT * FROM r501");
$select1->execute();
print "\nEjecutar SELECT de r501\n";
my $mysql_dbh1 = DBI->connect("DBI:mysql:database=$datafilename;ho
+st=localhost",
"root", "xyz123",
{'RaiseError' => 1});
while ( (my @row) = $select1 -> fetchrow_array() ){
my $sthsql = $mysql_dbh1->prepare ("INSERT INTO r501 (reg, pat, ped,
+ adnasec, impexp, cveped, adnaent, crupimp, rfcimp, curpaa)
VALUES ($row[0], $row[1], $row[2]
+, $row[3], $row[4], $row[5], $row[6], $row[7], $row[8], $row[9]")
$sthsql->execute();
}
I trim the amount of the data being inserted but still a viable example.
I hope someone can explain it a little bit more with an example, sorry if these is to much work, I really like perl has help me do things that would take a lot of time doing in something else, it just that I did not get it .
Thank you !
-
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.