php mySQL question

2003-04-03 Thread Robbie Staufer
Hi,

I have a php form that takes in data for a mysql query.  The script that 
processes the form takes the variables from the form and submits them to 
the db.

What if the field after LIKE needs to be imprecise?  The variable 
somehow needs to be converted to a regular expression like /'%expr%'/ 
so the query will match the expression anywhere in the line.  I can't 
put $var inside the regex delimiters, so not sure what else to try.

Any ideas?
Thanks,
Robbie
--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


Re: $from_address

2003-03-29 Thread Robbie Staufer
Thanks to all for your help with the $from address thing.  Removing the 
single quotes did the trick.

Robbie

R. Joseph Newton wrote:

Robbie Staufer wrote:

 

Hi,

I have a perl script that takes in form data and generates and email
with the data to be sent to me.  I'm getting the error message
Error:Bad or missing From address: '$from_address'.  The webmaster says
I'm using the correct from address, so, any ideas about this error message?
Thanks.
Robbie
Here's what I have:
   

Hi Robbie,

Others have pointed out at least one essential problem, that the single quotes prevent your variables from being interpolated.  I  don't know for sure if this is part of the problem, but I noticed something else:

 

Error:Bad or missing From address: '$from_address'.
   

There is no From address in your script

 

   from=> '$from_address',
   

There is a from address.

I'm not sure if it makes a difference, but I would suggest that if you still have problems after fixing the literal [single] quotes around your variables, you try From and To, etc.

And [I can't tell for sure from this snippet, but]...
use strict;
Joseph

 

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



$from_address

2003-03-28 Thread Robbie Staufer
Hi,

I have a perl script that takes in form data and generates and email 
with the data to be sent to me.  I'm getting the error message   
Error:Bad or missing From address: '$from_address'.  The webmaster says 
I'm using the correct from address, so, any ideas about this error message?

Thanks.
Robbie
Here's what I have:

### send mail #

$from_address = "[EMAIL PROTECTED]";
$to_address = "[EMAIL PROTECTED]";
$subject = "ESMF Registration Form";
%mail = (
   SMTP=> 'finster.scd.ucar.edu',
   from=> '$from_address',
   to  => '$to_address',
   subject => '$subject',
   );
$mail{body} = <

First Name: $fname
Last Name: $lname
Email: $email
Organization: $org
Scientific Interest: $sci_int
Mailing List? $check
sendmail(%mail) || print "Error: $Mail::Sendmail::error\n";

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


[Fwd: RE: javascript and perl dbi]

2003-03-26 Thread Robbie Staufer


 Original Message 
Subject: RE: javascript and perl dbi
Date: Wed, 26 Mar 2003 13:03:50 -0600
From: "Dan Muey" <[EMAIL PROTECTED]>
To: "Robbie Staufer" <[EMAIL PROTECTED]>
CC: <[EMAIL PROTECTED]>


javascript... ... HTML Just watch out for your quotes and backslash them 
if need be. DMuey >there's no tag to house the java script. So I don't 
know where to put it. >I hope I explained my question clearly. Can you 
show me an example of how it should look? >Many thanks, >Robbie

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


perl code in browser window

2003-03-26 Thread Robbie Staufer
Hi,

Has anyone had this problem?  I have a perl script that produces an html 
form among other things, and when I open it in the browser window, all 
of the perl coding shows up along with the html form.  I've never had 
this problem before.  Does anyone know what causes it?

Thanks,
Robbie
--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


javascript and perl dbi

2003-03-17 Thread Robbie Staufer
Hi,

I have a web page where I've used Java Script to set up some relational 
menus, within a php script to send form data to a perl DBI script for 
querying a database.  The user selects an option from the first menu, 
and an option from the second menu, and these values need to be passed 
either to the php section of the script, or directly to the DBI script. 
Is this nuts, or is there a way to pass the JS values to php or DBI?

Inorvermyhead,
Robbie
--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


internal server error

2003-03-17 Thread Robbie Staufer
Hi,

I have a partial perl script for a mock-up web page, that will collect 
information from users as part of a registration form.  In trying to see 
what it looks like so far on the web, I'm getting an internal server 
error.  I thought that the script, though partial, was at least closed 
out correctly, but I'm missing something.  If anyone has time to take a 
look, it would be much appreciated.

Robbie

#!/fs/local/bin/perl

use CGI qw(:standard);
use Mail::Sendmail;
## initialize global variables and fill in
## values from the query parameters
## (submitted via form)
$fname  = param('FName');
$lname  = param('LName');
$email  = param('Email');
$org= param('Org');
$sci_int= param('Sci_Int');
$radio  = param('Radio');
$check  = param('Check');
$query = new CGI($query);
$state = param('state');
print $query->header;

#
 stage 1 user info form
#
if (!$state) {

print $query->start_html('ESMF Registration Form');

print "";
print "";

print "ESMF Registration Form";
print "";
print "Please read the lice
nsing agreement, fill out the form below, click the accept button, and h
it Next.";
print "Copyright 2002-2003, blah,
blah, blah";
print "";

print "texttexttexttexttext";
print "";

print "The National Center for
Atmospheric Research is sponsored by the National Science Foundation.
Any opinions, findings and conclusions or recommendations expressed in t
his publication are those of the author(s) and do not necessarily reflec
t the views of the National Science Foundation.";
print "&bnbsp;";

print "User Information
";
print end_html;

}

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Perl book

2003-01-15 Thread Robbie Staufer
There is a pink and a blue camel book from O'Reilly.  What is the
difference, and which comes most highly recommended?

Robbie

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




first row of database

2002-12-10 Thread Robbie Staufer
Hi,

Is there a way to refer to the first row of a database (row 0?) ?

For example, the first row of my database contains header information.
I want the header row to print out first whenever data is requested, so
the output file looks like this:

header,  header, header, header, header
data, data, data, data, data,
data, data, data, date, data

I know how to print out the data, but can't figure out how to ask for
the first row.

Many thanks,
Robbie

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: why error message?

2002-12-10 Thread Robbie Staufer
Thanks.  Problem solved.

Robbie


Mystik Gotan wrote:

> Maybe you're trying to accomplish this:
>
> while ($id == $sth->fetchrow_array) {
>
> I'm pretty sure this will cause the error you're looking for.
>
> --
> Bob Erinkveld (Webmaster Insane Hosts)
> www.insane-hosts.net
> MSN: [EMAIL PROTECTED]
>
> >From: Robbie Staufer <[EMAIL PROTECTED]>
> >To: [EMAIL PROTECTED]
> >Subject: why error message?
> >Date: Tue, 10 Dec 2002 09:55:48 -0700
> >
> >Hi,
> >
> >Can anyone tell me why this while loop would give me this error message?
> >
> >while ( ($id) = $sth->fetchrow_array) {
> >   $sth->execute();
> >   @header_row = $sth->fetchrow_array;
> >   ## loop through the row array and print with comma space delimiters
> >   ## print two new lines at the end of the row for double spacing
> >   for ($i=0; $i < @header_row; $i++) {
> >  print CODEINFO ($header_row[$i]);
> >  print CODEINFO ',';
> >  print CODEINFO ' ';
> >   }
> >   print CODEINFO "\n \n";
> >}
> >
> >error:  DBD::mysql::st fetchrow_array failed: fetch() without execute()
> >
> >Many thanks for your time.
> >
> >Robbie
> >
> >--
> >-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> >Robbie Staufer
> >NCAR/SCD
> >1850 Table Mesa Dr. Rm. 42
> >Boulder, CO. 80305
> >(303) 497-1836
> >
> >
> >
> >--
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
>
> _
> MSN Zoeken, voor duidelijke zoekresultaten!
> http://search.msn.nl/worldwide.asp

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




why error message?

2002-12-10 Thread Robbie Staufer
Hi,

Can anyone tell me why this while loop would give me this error message?

while ( ($id) = $sth->fetchrow_array) {
  $sth->execute();
  @header_row = $sth->fetchrow_array;
  ## loop through the row array and print with comma space delimiters
  ## print two new lines at the end of the row for double spacing
  for ($i=0; $i < @header_row; $i++) {
 print CODEINFO ($header_row[$i]);
 print CODEINFO ',';
 print CODEINFO ' ';
  }
  print CODEINFO "\n \n";
}

error:  DBD::mysql::st fetchrow_array failed: fetch() without execute()

Many thanks for your time.

Robbie

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




bareword question

2002-11-25 Thread Robbie Staufer
Hi,

I'm writing a DBI script that will read data from a text file and insert
it into a database.

When I come to the point of the 'open' statement:

open(CODEINFO, $data_file) || die "Unable to open $data_file:";

I get the following error messages:

Bareword found where operator expected near "open(CODEINFO,
'$data_file') || die "Unable"

and

syntax error near "open(CODEINFO, '$data_file') || die "Unable to "
Can't find string terminator '"' anywhere before EOF.

I don't know which would be the bareword or how to change it, and I
don't know why perl can't see the string terminator in "Unable to open
$data_file:";

If someone has a minute, could you help?

Thanks!

--
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Robbie Staufer
NCAR/SCD
1850 Table Mesa Dr. Rm. 42
Boulder, CO. 80305
(303) 497-1836



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]