Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re^3: perl variable displayed as a hash value

by space_monk (Chaplain)
on Jun 01, 2013 at 14:48 UTC ( #1036449=note: print w/replies, xml ) Need Help??

in reply to Re^2: perl variable displayed as a hash value
in thread perl variable displayed as a hash value

More questions:
  1. Why does the second sqlSelect statement not have a $mydb reference? At the best you are being inconsistent.
  2. The following code will not handle undefined items gracefully. I hope the database can be guaranteed to return empty strings if no data is present for fields.
  3. You should separate getting the data into %ARTICLE from its presentation in HTML. i.e. separate the Model from the View

sub getLastEnchereurDetail { my $article = $query->param("article"); my $ref_max_enchereur; my $max_enchere; ($ARTICLE{'max_enchere'})=$mydb->sqlSelect1("MAX(prix)", "enchere" +, "ref_article = '$article'"); if ($ARTICLE{'max_enchere'} ne '') { ($ARTICLE{'max_enchereur'},$ARTICLE{'id_enchere'})=$mydb->sqlS +elect1("ref_enchereur,id_enchere", "enchere", "ref_article = '$articl +e' AND prix = $ARTICLE{'max_enchere'}"); # why is this not $mydb->sqlSelect1 like above? my @result = sqlSelect("nom_utilisateur,email,lang,adresse,vil +le,npa,no_telephone,nom,prenom", "personne", "id_personne = '$ref_max +_enchereur'"); ($ARTICLE{'nom_utilisateur_acheteur'},$ARTICLE{'email_ +acheteur'}, $ARTICLE{'acheteur_lang'},$ARTICLE{'acheteur_adresse'}, $ARTICLE{'acheteur_ville'},$ARTICLE{'acheteur_npa'}, $ARTICLE{'acheteur_telephone'},$ARTICLE{'acheteur_nom'}, $ARTICLE{'acheteur_prenom'})= @result; } my $string =<<EOF; <td align="left" width="200"><label id="label_category_name">$SERVER{' +last_enchereur'}</label></td> <td align="left"> <a href="/cgi-bin/recordz.cgi?lang=$lang&amp;session=$session_id&p +age=profil_vendeur&username=$ARTICLE{'nom_utilisateur_acheteur'}" cla +ss="menulink"> $ARTICLE{'nom_utilisateur_acheteur'}</a></label> </td> EOF return $string; }
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)

Replies are listed 'Best First'.
Re^4: perl variable displayed as a hash value
by *alexandre* (Novice) on Jun 01, 2013 at 19:38 UTC
    Solved by retrieving the data from the second parameter

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036449]
and the questions are moot...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (8)
As of 2018-06-20 14:38 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.