List:General Discussion« Previous MessageNext Message »
From:Christopher R. Jones Date:July 19 2000 2:40pm
Subject:Re: Using arrays to grab data out of Mysql
View as plain text  
This is not a MySQL problem.  It is a Perl/CGI problem.  When in doubt read 
the documentation.  The CGI manual states that the -default parameter takes 
any string value.  You are passing an array so only the first item in the 
array is actually passed to the textarea function.
Try:
my @arrinstr=();
$c=0;
my $list="";
while (@arrinstr = $sth4->fetchrow)
{
($sec,$title,$des,$credit,$schdays,$timein,$timeout)=@arrinstr;
.
.
.
.
$list.="$csec   $ctitle  $cdes $ccredit  $cschdays $ctimein-$ctimeout\n";
.
.
.
print $query->textarea ({-name=>'INFO', -default=>$list,-cols=>'35', 
-rows=>'5'});

Note the end of line included each time in $list.  This is necessary 
otherwise the textarea would just have 1 long string and would wrap at the 
wrong places.



>Is there a way that I can fill Mysql info into a Textarea in Perl-CGI
>
>I am trying the following and can only print one line - but I know I
>have  three lines of data:
>
>my $sth4 = $dbh->prepare("select
>sec,title,des,credit,schdays,timein,timeout from table where
>done=\"No\" ") or bail_out("Cannot Connect");
>$sth4->execute;
>
>my @arrinstr=();
>$c=0;
>while (@arrinstr = $sth4->fetchrow)
>{
>($sec,$title,$des,$credit,$schdays,$timein,$timeout)=@arrinstr;
>$csec=$sec;
>$ctitle=$title;
>$cdes=$des;
>$ccredit=$credit;
>$cschdays=$schdays;
>$ctimein=$timein;
>$ctimeout=$timeout;
>$list = "$csec   $ctitle  $cdes $ccredit  $cschdays
>$ctimein-$ctimeout";
>@arrlist[$c]=($list);
>#push (@arrlist, $list);
>$c=$c+1;
>}
>print "<tr><td>";
>print $query->textarea ({-name=>'INFO', -default=>@arrlist,-cols=>'35',
>-rows=>'5'});
>
>-------->  The output looks like this 006   Print Making  MC 3  W
>08:00-09:15
>
>------------
>Can anyone help shed light on this crazy array problem?  All I want is
>to print this info in a textarea so that the user
>can scroll up and down through the data.  I can get it to print to the
>page fine but not in the textarea.?  Thought I could use
>the push command to add the other lines of data but it didn't seem to
>help.
>
>Also,
>
>Question about permissions:  Is it true that when you create a user in
>the mysql mysql database that you should set all
>permission statements, such as select, update etc.  to "N"  and then in
>the database table when you link the user to a database - this is where
>you would allow the selected permissions for functions like select and
>update?  Basically, we create a blank user with no username or password
>and then set all permissions to "Y" in the user table of mysql.  Then we
>linked that user to the test database.  So at the command line that user
>could go into the database test, but could also go into all the other
>databases.
>To solve this we set all permission statement for the user with no
>username or password to "N" in the user table.
>
>Is this correct??
>
>Thanks,
>
>Douglas
>
>--
>
>Douglas Brantz
>Computer Consultant
>Fine & Applied Arts
>Appalachian State University
>Boone, NC 28608
>
>828-262-6312 FAX
>828-262-6549 OFFICE
>brantzdr@stripped
>
>
>
>--
>---------------------------------------------------------------------
>Please check "http://www.mysql.com/php/manual.php" before
>posting. To request this thread, e-mail mysql-thread44583@stripped
>
>To unsubscribe, send a message to:
>     <mysql-unsubscribe-cj=interlog.com@stripped>
>
>If you have a broken mail client that cannot send a message to the above 
>address(Microsoft Outlook), you can use 
>http://lists.mysql.com/php/unsubscribe.php


Christopher R. Jones, P.Eng.
14 Oneida Avenue
Toronto, Ontario M5J 2E3
Tel. 416 203-7465
Fax. 416 203-3044
Email cj@stripped


Thread
Using arrays to grab data out of MysqlDouglas Brantz19 Jul
  • Re: Using arrays to grab data out of MysqlChristopher R. Jones19 Jul