Data Base Open Problem ( Very Urgent) : LUSENET : S-Mart Shopping Cart : One Thread


I have tried smart shopping cart. My main problem is the script is not opening/showing the product data base (demo.db). What I mean is when I click on to list all items or searching any particular group it is not showing the contains. I will be very grateful if any one help. I need it very urgently.Although demo.db is in the cgi-bin & it has chmod 777 permission.



-- Kumar (, May 27, 1999


I had the same problem too. My fix was to make sure all the files are in the same directory and have the base path in the smart.cfg file set to the the same directory. Set to use the smartadmin.cgi file then open the demo.db file and enter the products there. Hope it helps. Jim

-- James L. Farmer (, May 27, 1999.

Hello, just an idea: Do you checked that the value for "basepath" is the correct path to your db-file and that the value for "resourcedb" is the name of the db file? Wenn smart.cgi opens the db file it uses the file "resourcedb" in path "basepath". For my installation this is not the cgi-bin but a directory where my html files (header, footer, ...) are, something like /usr/local/httpd/htdocs/shop/


-- Hans-Juergen Thiess (, June 01, 1999.


Sorry It did not work. Can any body send all the files as well as the paths they used in the the programs. Please help.

Regards Kumar

Note : my other e-mail address is not working please send any reply in this address

-- Kumar (, June 01, 1999.

Did you try entering the information with a text editor such as Notepad directly into the demo.db file. You do not have to enter all your information just add about ten items to check your program. Then upload the file to your server. If this does not fix it your paths are set wrong. Most of my problems I fixed in the smart.cfg file just had to do with setting the right paths. Also check to see if your permisions are set right in the "Readme" file it tells you what to set the "chmod" to.

2. Set these permissions: a. telnet to your server (i.e. telnet b. go to the directory were you uploaded the files from step 1. c. use the UNIX command 'chmod' the set permissions. d. chmod 755 *.cgi ; chmod 755 *.lib e. If you are using CGIWrap, or Apache with SetUID then you may not need to do this. f. chmod 777 demo.db g. chmod 755 *.html

If you change a file then upload it or even edit on line it will change the permisions you have to reset them every time you edit your file.


-- James L. Farmer (, June 02, 1999.

When I did used the following statements I did manage to open the data base. I made the changes to read the data base . Main problem I did find is in the Subroutine sub gen_page. That is causing all the problems. Is the subroutine all right to work sub gen_page { #my($SIZE,$i); &print_header; # Table header, change this for table options! print "
\n"; print "\n"; #open (FILE,"$basepath$delim$resourcedb") || die "Content-type: text/html\n\nCan't Open $resourcedb(r): $!\n"; open (FILE,"demo.db") || die "Content-type: text/html\n\nCan't Open data base $!\n"; while () { my($itemid, $name, $price, $descrip, $image, $group) = split(/\|/,$_); print "
\n"; print "\n"; print ""; print "$name
\n"; print "$price
\n"; print "$descrip
\n"; print "
\n"; } #my(@LINES)=; close(FILE); $SIZE=@LINES; if ($type eq 'all') { my($max) = $pos + $numtolist; if ($max > $SIZE) { $max = $SIZE; } for ($i=$pos;$i<$max;$i++) { my(%ITEM); ($ITEM{'itemid'}, $ITEM{'name'}, $ITEM{'price'}, $ITEM{'descrip'}, $ITEM{'image'}, $ITEM{'group'}) = split(/\|/,$LINES[$i]); &print_item(\%ITEM); } print "
\n"; if ($max < $SIZE) { print "
Next $numtolist items
\n"; } } elsif ($type eq 'search') { my($matches) = 0; my($i) = $pos; while (($matches < $numtolist) && ($i < $SIZE)) { if (index(lc $LINES[$i],lc $FORM{'search'}) >= 0) { $matches++; my(%ITEM); ($ITEM{'itemid'}, $ITEM{'name'}, $ITEM{'price'}, $ITEM{'descrip'}, $ITEM{'image'}, $ITEM{'group'}) = split(/\|/,$LINES[$i]); &print_item(\%ITEM); } $i++; } print "\n"; if ($i < $SIZE) { print "\n"; print "\n"; print "\n"; print "
\n"; } } elsif ($type eq 'group') { my($matches) = 0; my($i) = $pos; while (($matches < $numtolist) && ($i < $SIZE)) { $_=$LINES[$i]; my(%ITEM); ($ITEM{'itemid'}, $ITEM{'name'}, $ITEM{'price'}, $ITEM{'descrip'}, $ITEM{'image'}, $ITEM{'group'}) = split(/\|/,$_); my(@groups) = split(/,/,$ITEM{'group'}); my(%is_group); undef %is_group; for (@groups) { $is_group{$_} = 1 } if ($is_group{$FORM{'group'}}) { $matches++; &print_item(\%ITEM); } $i++; } print "\n"; if ($i < $SIZE) { print "Continue Search\n"; } } The changes I made in the top is to check whether it can read Please help to solve the problem Regards Kumar

-- Kumar (, June 02, 1999.

All I can see is that you open the db-file now without using the variables (basepath, resourcedb) and use the name of the file (demo.db) directly. If this works, your values for the variables must be wrong concernig the path/name to demo.db. But, of course, you can do it this way.

-- Hans-Juergen Thiess (, June 02, 1999.


I did set the basepath as follows. As all my header, footer, order and data base all are in my cgi-bin. When I am running the smart.cgi header, footer and order file coming perfectly except the problem with the opening the data base. My $cgiurl $cgiurl = "";

My $basepath # what is the base path to the directory where the files are (header,footer, order form)? $basepath= ".";

Again when I tried to use actual path $basepath= ""; This path giving me file not found error. Any suggestion will be appreciated with thanks.



-- Kumar (, June 02, 1999.

I think that the value for "basepath" has to be an absolute path name and not an URL (likewise "mailprog" and "tmpdir").

Something like:


If you don't know this path, you have to ask your provider.


-- Hans-Juergen Thiess (, June 02, 1999.

Moderation questions? read the FAQ