Ik heb vanochten dadabik geinstalleerd die parallel op phpmyadmin loopt en die direct en mogelijkheid geeft om een web space aan te geven (prima programma) dat erkt ook goed en ik weet nu zeker dat het mn perl script is die m verandert hieronder het gehele script:
CODE:
#! /usr/bin/perl -w
#@ MAIN_PROGRAM
# res_search.pl - search residential real estate listings
use strict;
use lib qw(/usr/lib/perl5/5.00503);
use CGI qw(:standard escapeHTML);
use WebDB;
use WebDB::TableInfo;
print header (),
start_html (-title => "Resultaten van Uw zoekopdracht", -bgcolor => "FF,FF,FF", -style => "
BODY {
color: gray;
font-size: 10pt;
font-family: arial;
font-weight: normal;
}
A:link, A:visited { text-decoration: none }
A:hover { background: black }
" );
my $dbh = WebDB::connect ();
# Dispatch to proper action based on user selection
my $choice = lc (param ("choice")); # get choice, lowercased
if ($choice eq "") # initial invocation
{
display_form ($dbh);
}
elsif ($choice eq "zoek") # perform search
{
perform_search ($dbh); # present the results
}
else
{
print p (escapeHTML ("Logic error, unknown choice: $choice"));
}
$dbh->disconnect ();
print end_html ();
exit (0);
#@ MAIN_PROGRAM
# ----------------------------------------------------------------------
#@ DISPLAY_FORM
sub display_form
{
my $dbh = shift;
my $tbl_info;
my ($location_val_ref, $bed_val_ref, $bath_val_ref);
my ($price_val_ref, $price_label_ref);
my (@style, @features);
$tbl_info = WebDB::TableInfo->get ($dbh, "residence");
# Generate the popup menus for the option lists. Add an "Any" item
# to the head of each list to serve as the default value.
# Values for architectural styles are in the style column definition
@style = $tbl_info->members ("style");
unshift (@style, "Any");
# Values for locations, prices, and numbers of bedrooms and bathrooms
# are in lookup tables. For prices, there are labels that differ from
# the values.
$location_val_ref = WebDB::get_lookup_values (
$dbh,
"SELECT value FROM res_location ORDER BY value");
unshift (@{$location_val_ref}, "Any");
# Look up values and labels for price range. For a value of
# 100000, generate a label of "Up to $100,000".
($price_val_ref, $price_label_ref) = WebDB::get_lookup_values (
$dbh,
# use q{ ... } so Perl leaves the $ alone
q{ SELECT value, CONCAT('Tot EUR',FORMAT(value,0))
FROM res_price ORDER BY value });
unshift (@{$price_val_ref}, "Any");
$price_label_ref->{Any} = "Any";
$bed_val_ref = WebDB::get_lookup_values (
$dbh,
"SELECT value FROM res_bedrooms ORDER BY value");
unshift (@{$bed_val_ref}, "Any");
$bath_val_ref = WebDB::get_lookup_values (
$dbh,
"SELECT value FROM res_bathrooms ORDER BY value");
unshift (@{$bath_val_ref}, "Any");
# Get additional features list from the features column definition
@features = $tbl_info->members ("features");
print start_form (-action => url ()),
p ("Please select the characteristics for the type of home in\n"
. "which you're interested, then select the Search button."),
table ({-border => 1},
Tr (
td ("Locatie:"),
td (popup_menu (-name => "location",
-values => $location_val_ref))
),
Tr (
td ("Maximum prijs:"),
td (popup_menu (-name => "price",
-values => $price_val_ref,
-labels => $price_label_ref))
),
Tr (
td ("Soort woning:"),
td (popup_menu (-name => "style",
-values => \@style))
),
Tr (
td ("Minimum aantal slaapkamers:"),
td (popup_menu (-name => "bedrooms",
-values => $bed_val_ref))
),
Tr (
td ("Minimum aantal badkamers:"),
td (popup_menu (-name => "bathrooms",
-values => $bath_val_ref))
),
Tr (
td ("extras:"),
td (checkbox_group (-name => "features",
-values => \@features,
-linebreak => 1))
)
),
br (), br (),
submit (-name => "choice", -value => "zoek"),
end_form ();
}
#@ DISPLAY_FORM
#@ PERFORM_SEARCH
sub perform_search
{
my $dbh = shift;
my $tbl_info;
my $val;
my @condition; # conditions for WHERE clause
my @placeholder; # values for placeholders
my ($sth, $stmt, $col_list, $where);
my $count;
# Collect conditions corresponding to the
# parameters specified in the search form.
#@ CONSTRUCT_LOCATION_TEST
$val = param ("location");
if (defined ($val) && $val ne "Any")
{
push (@condition, "location = ?");
push (@placeholder, $val);
}
#@ CONSTRUCT_LOCATION_TEST
#@ CONSTRUCT_PRICE_TEST
$val = param ("price");
if (defined ($val) && $val ne "Any")
{
push (@condition, "price <= ?"); # specified price is a maximum
push (@placeholder, $val);
}
#@ CONSTRUCT_PRICE_TEST
$val = param ("style");
if (defined ($val) && $val ne "Any")
{
push (@condition, "style = ?");
push (@placeholder, $val);
}
#@ CONSTRUCT_BEDROOMS_TEST
$val = param ("bedrooms");
if (defined ($val) && $val ne "Any")
{
push (@condition, "bedrooms >= ?"); # value is a minimum
push (@placeholder, $val);
}
#@ CONSTRUCT_BEDROOMS_TEST
#@ CONSTRUCT_BATHROOMS_TEST
$val = param ("bathrooms");
if (defined ($val) && $val ne "Any")
{
push (@condition, "bathrooms >= ?"); # value is a minimum
push (@placeholder, $val);
}
#@ CONSTRUCT_BATHROOMS_TEST
# Figure out the numeric value of the selected features so that
# we can use it in comparisons against the features SET column.
#@ CONSTRUCT_FEATURES_TEST
$tbl_info = WebDB::TableInfo->get ($dbh, "residence");
$val = $tbl_info->get_list_numeric_value ("features");
if ($val > 0) # are any features required?
{
push (@condition, "((features + 0) & ?) = ?");
push (@placeholder, $val, $val); # need value *twice*
}
#@ CONSTRUCT_FEATURES_TEST
#@ CONSTRUCT_QUERY
# List of columns to select (format price with commas and
# a leading dollar sign), (proberen description te formatteren als link)
$col_list = "id, location, CONCAT('\ EUR ',FORMAT(price,0)) AS price,"
. "style, bedrooms, bathrooms, features, description";
# WHERE clause listing the conditions
$where = "WHERE " . join (" AND ", @condition) if @condition;
$where = "" unless $where;
# complete query
$stmt = "SELECT $col_list FROM residence $where"
. " ORDER BY location LIMIT 100";
#@ CONSTRUCT_QUERY
#@ EXECUTE_QUERY
$sth = $dbh->prepare ($stmt);
$sth->execute (@placeholder);
$count = 0;
while (my $ref = $sth->fetchrow_hashref ())
{
display_listing ($ref);
++$count;
}
$sth->finish ();
print ("Sorry, geen treffende woningen gevonden. Klik in u browser op back om terug te gaan en een nieuwe zoek
opdracht op te geven !") if !$count;
#@ EXECUTE_QUERY
}
#@ PERFORM_SEARCH
#@ DISPLAY_LISTING
sub display_listing
{
my $ref = shift;
my @row; # array to hold display table rows
my @col_name = # columns to display, in the order they should be displayed
(
"id", "location", "price", "style", "bedrooms", "bathrooms", "features", "description"
);
my %label = # labels for each column
(
"id" => "Woning ID",
"location" => "Locatie",
"price" => "Vraagprijs",
"style" => "Soort woning",
"bedrooms" => "Aantal slaapkamers",
"bathrooms" => "Aantal badkamers",
"features" => "extras",
"description" => "beschikbare informatie"
);
# Generate table rows; each one contains a label and a value
foreach my $col_name (@col_name)
{
push (@row, Tr (
td ($label{$col_name} . ":"), # label
td (escapeHTML ($ref->{$col_name})) # value
));
}
print hr (), table ({-border => 0}, @row);
}
#@ DISPLAY_LISTING
iemand en idee hoe ik dat zou kunnen veranderen dat hij m niet meer omzet
(de fout zit in de script, script werkt verder goed !!!)
bedankt...