Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 11th, 2000, 09:17 AM
Peekay Peekay is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2000
Posts: 0 Peekay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I hope this is the right place to post - I have a problem with mSQL
which I'm sure is just due to something silly which as someone new to
mSQL I have just missed out.

I'm trying to write a program, as below, which takes info from a form
and checks a table to see if the userid has been created before.

The program runs through ok and prints out the HTML at the end, but
when I re-run the program it does exactly the same - though it should
show a different page (the else info that is missing from the below)
as the user has already been entered into the dbase.

Help!

PK

#!/usr/bin/perl

use strict;
use CGI;
use Msql;

my $qr = new CGI;
my $qo = new CGI;
$qr->import_names( "res" );

my $usertemp = $res::userid;
my $db = Msql->connect;

$db->selectdb('emcdbase');
my $sq = "SELECT userid FROM personaldata WHERE userid = $res::userid
";
my $output = $db->query($sq);
my @values = $output->fetchrow;

if ($values[0] ne $usertemp)
{

my $outputed = $db->query("INSERT INTO personaldata (userid, fname,
sname, address1, address2, town, county, pcode, country, phone) VALUES
( $res::userid, $res::fname, $res::sname, $res::address1,
$res::address2, $res::town, $res::town, $res::county, $res: URLcode,
$res::country, $res: URLhone");

my $created = $db->query("SELECT userid FROM personaldata WHERE userid
= $usertemp ");
my $person = $created->as_string;

print <<END_OF_MESSAGE;
Content-type: text/html

# Rest of HTML deleted

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > mSQL.pm beginner needs help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway