mysql - Separate query in single var and execute it using perl script -


i have working on perl script.

select column1,column2,column3.. table. 

this query contain part in $cmd="select column1 "; , other $cmd1=",column2,column3 table"; // dynamic part, split query in 2 different variable. after execute whole query.

how query splitting part.?

use dbi; use strict; use warnings;  # input ! $cmd  = "select column1 ";  $cmd1 = ",column2,column3 table";  # wondering why have query ... # anyway, lets assume there's reason behind this!  $dbh =      dbi->connect(         'dbi:mysql:databasename;host=db.example.com', # todo change         'username',                                   # todo change         'password',                                   # todo change         { raiseerror => 1 }     ) or die "could not connect database: $dbi::errstr";  $sth = $dbh->prepare( $cmd . $cmd1 );  $sth->execute();  @row; while ( @row = $sth->fetchrow_array ) {     print "@row\n"; } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -