You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Scott Chapman <sc...@mischko.com> on 2002/04/13 00:44:42 UTC

Can't call method "fetch" on an undefined value .... Second try.

This is cleaner but gives me the error: Can't call method "fetch" on an 
undefined value.

    $sth = $req->{tcdb}->prepare ("SELECT order,name FROM pages ORDER 
BY order");
    $sth->execute();
    $sth->bind_columns(\($order, $name));

-]
<html>
<head>
</head>
<body>

<form>
  <select name="test">
    [$ while $sth->fetch $]
	    <OPTION VALUE="[+ $order +]">[+ $name +]</OPTION>
    [$ endwhile $]
  </select>

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Can't call method "fetch" on an undefined value .... Second try.

Posted by Gerald Richter <ri...@ecos.de>.

> This is cleaner but gives me the error: Can't call method "fetch" on an
> undefined value.
>

Either you have defined $sth as "my" variable, so it isn't defined after the
[- -] block, or your prepare fail. It's a good idea to check DBI::errstr, to
see if there is an error.

Gerald

-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------




---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org