CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate:
I'm Stuck -- Tranfer from Begginer's forum



Jan 14, 2001, 4:31 PM

Post #1 of 3 (218 views)
I'm Stuck -- Tranfer from Begginer's forum Can't Post

Okay, for my next question....

I'm pulling data into a hash. The data is in a MySQL database and I've prepared a statement ('select * from table')

What I want to do know is check 2 variables $first and $last to see if they both exist simultaniously (did I spell that right?) for example

$first=$q->escapeHTML( $q->param('first'));
$last=$q->escapeHTML( $q->param('last'));

##as you can see I've escaped the html so some doofus won't take advantage of it.

So the variables are defined by the form of an HTML

Now the query listed above is pulled into a HASH using $sth->fetchrow_hashref; I call the hash STUFF

Stuff has in each row the following
first last moredata moredata moredata

I want to compare $first with field first and $last with field last. If they match it goes HERE and if not it goest THERE

am I making any sence? I've lost myself already



Jan 19, 2001, 7:58 AM

Post #2 of 3 (205 views)
Re: I'm Stuck -- Tranfer from Begginer's forum [In reply to] Can't Post

Let's see if this makes sense: if your visitor inputed something, and they match, put it here, else put it there.

if ($first == $sqlfield && $last == $sqlfield) {
#sql code executes here if they match
#this executes if they don't

Ok, $sqlfield contains the sql stuff you want to compare. You'll have to do the sql coding yourself(I don't know much about that)


Jan 19, 2001, 8:33 AM

Post #3 of 3 (202 views)
Re: I'm Stuck -- Tranfer from Begginer's forum [In reply to] Can't Post

Okay, I had to smack myself for this one. It seems so simple. Ughn.... I'll go try it and let you know how it all works out. Thank Cir



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives