Hello!
I'm having some real problems with displaying user's records. I have similar problems as described here: http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/002683.html .
$status2 returns "no matches found" everytime i try to display records that belong to a particlar user.
print "$col<BR>";}
This code prints a list of my edit.cfg colums columns - ok.
My codes:
#-------------------------------------------
$cols = 'rID,Date,UserID,Program Name,Review Title,Review';
@db_cols = split (/,/, $cols);
$db_file_name = $db_script_path . "/databases/reviewz.db";
$db_sort{'DateAdded'} = 'Date';
}
sub switch_to_user {
#-------------------------------------------
$cols = 'UserID,Name,E-mail,Display E-mail,ICQ,Website URL,Empty';
@db_cols = split (/,/, $cols);
$db_file_name = $db_script_path . "/databases/users.db";
$db_key_pos = 0;
}
Here is what i have in sub html_record:
foreach $col (@db_cols) { print "$col<BR>";} # prints edit.cgi's columns
undef %in;
$rec{'UserID'} =~ s/<?.B>//g;
$in{'UserID'} = $rec{'UserID'} ;
$in{'sb'} = 1;
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
print "$status2"; #prints status of search
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print "<table>";
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=edit&uid=$db_uid&Program+Name=$rec2{'Program+Name'}&view_records=1">$rec2{'Program+Name'}</a><BR>
</td></tr>|; } print "</table>";}
&switch_to_user;
Database definitions for user.cfg
UserID=> [0,'alpha',-1,8,1,'',''],
Name => [1,'alpha',40,45,1,'',''],
'E-mail'=> [2,'alpha',40,80,, '', '.+@.+\..+'],
'Display E-mail' => [3,'alpha',0,3, 1,'No',''],
ICQ => [4,'numer',10,10,0,'','\d{5}'],
'Website URL' => [5,'alpha',40,300, 0,'','^http|ftp'],
Empty=> [6,'alpha',1,1,0,'','']);
Here are my db definitions for edit.cfg:
Date => [1,'date',-1,15,1,&get_date,''],
UserID => [2,'alpha',-1,15,1,'',''],
'Program Name' => [3,'alpha',0,50,1, '---',''],
'Review Title' => [4,'alpha',0,50,1,'',''],
Review => [5,'alpha',0,500, 0,'','']
and heres what my databases look like:
User2|User2 Name|user2@nowhere.com|Yes|1234567|http://none.com|
edit.db
13|27-Apr-2000|User2|SomeProgramName|What i think of it|User comments go here.
[This message has been edited by db (edited April 27, 2000).]
I'm having some real problems with displaying user's records. I have similar problems as described here: http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/002683.html .
$status2 returns "no matches found" everytime i try to display records that belong to a particlar user.
Code:
foreach $col (@db_cols) { print "$col<BR>";}
This code prints a list of my edit.cfg colums columns - ok.
My codes:
Code:
sub switch_to_edit { #-------------------------------------------
$cols = 'rID,Date,UserID,Program Name,Review Title,Review';
@db_cols = split (/,/, $cols);
$db_file_name = $db_script_path . "/databases/reviewz.db";
$db_sort{'DateAdded'} = 'Date';
}
sub switch_to_user {
#-------------------------------------------
$cols = 'UserID,Name,E-mail,Display E-mail,ICQ,Website URL,Empty';
@db_cols = split (/,/, $cols);
$db_file_name = $db_script_path . "/databases/users.db";
$db_key_pos = 0;
}
Here is what i have in sub html_record:
Code:
&switch_to_edit; foreach $col (@db_cols) { print "$col<BR>";} # prints edit.cgi's columns
undef %in;
$rec{'UserID'} =~ s/<?.B>//g;
$in{'UserID'} = $rec{'UserID'} ;
$in{'sb'} = 1;
$in{'so'} = 'descend';
$in{'mh'} = 100;
my ($status2,@hits2) = &query("view");
print "$status2"; #prints status of search
if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
print "<table>";
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash($_, @hits2);
print qq|
<tr><td>
<a href="$db_script_url?db=edit&uid=$db_uid&Program+Name=$rec2{'Program+Name'}&view_records=1">$rec2{'Program+Name'}</a><BR>
</td></tr>|; } print "</table>";}
&switch_to_user;
Database definitions for user.cfg
Code:
%db_def = ( UserID=> [0,'alpha',-1,8,1,'',''],
Name => [1,'alpha',40,45,1,'',''],
'E-mail'=> [2,'alpha',40,80,, '', '.+@.+\..+'],
'Display E-mail' => [3,'alpha',0,3, 1,'No',''],
ICQ => [4,'numer',10,10,0,'','\d{5}'],
'Website URL' => [5,'alpha',40,300, 0,'','^http|ftp'],
Empty=> [6,'alpha',1,1,0,'','']);
Here are my db definitions for edit.cfg:
Code:
rID => [0,'alpha', -1,8,1,'',''], Date => [1,'date',-1,15,1,&get_date,''],
UserID => [2,'alpha',-1,15,1,'',''],
'Program Name' => [3,'alpha',0,50,1, '---',''],
'Review Title' => [4,'alpha',0,50,1,'',''],
Review => [5,'alpha',0,500, 0,'','']
and heres what my databases look like:
Code:
user.db User2|User2 Name|user2@nowhere.com|Yes|1234567|http://none.com|
edit.db
13|27-Apr-2000|User2|SomeProgramName|What i think of it|User comments go here.
[This message has been edited by db (edited April 27, 2000).]