471,886 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,886 software developers and data experts.

how to increment character value

Sorry guys just wanted to learn. I have a database. When I do the search using mysql suppose i have 100 records I wanted to keep the first second ... in the loop to be retrain.
like an integer you may use $count = $count + 1;
then in the second round count value would be 2.
In this case I wanted the character to retain the old value incrementally
ex. first loop. kind = a
second. kind = a , b
3rd. kind = a , b c and so on

thanks. I need your help. thanks a lot
Dec 17 '06 #1
3 9020
GunnarH
83
I for one don't understand what you are talking about. Maybe it is because English isn't my first lanuage...

You may want to try talking Perl instead of English, i.e. show us the code you have prepared in an attempt to do whatever you are trying to do.
Dec 17 '06 #2
I for one don't understand what you are talking about. Maybe it is because English isn't my first lanuage...

You may want to try talking Perl instead of English, i.e. show us the code you have prepared in an attempt to do whatever you are trying to do.
-

$dbh = DBI->connect('dbi:mysql:dbname,user, pass);
#prepare and execute SQL statement
$sqlstatement="SELECT reg_id, category_id, category_name FROM table1 where category_id = \'$category_id\' ";
$sth = $dbh->prepare($sqlstatement);
$sth->execute ||
die "Could not execute SQL statement ... maybe invalid?";

print "<table border = 0>";
print "<td><p align=\"center\"><b>Reg ID</b></td>";
print "<td><p align=\"center\"><b>Category ID</b></td>";
print "<td><p align=\"center\"><b>Category Name</b></td>";
print "<tr>";
#output database results
while (@row=$sth->fetchrow_array)
{

my $query = "UPDATE table2 set category_name = \"$row[2]\" where reg_id = \"$row[0]\" ";



}

table1 having 100 records
the category_name under table2 are empty I wanted to fill this empty column with the value table1 under category_name would be placed using the condition of reg_id both table have same common entry.

Thanks
Dec 17 '06 #3
Do you mean something like this???

Expand|Select|Wrap|Line Numbers
  1. for ( $i=26, $c='a' ; $i ; $i--, $c=chr(ord($c)+1) ) { printf("$c\n"); }
Greetz, Doc
Dec 19 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

16 posts views Thread by Mansi | last post: by
14 posts views Thread by pai | last post: by
11 posts views Thread by divya_rathore_ | last post: by
13 posts views Thread by jehugaleahsa | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.