Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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:
  #1  
Old September 6th, 2000, 10:52 PM
gustavopeco gustavopeco is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Piscataway, NJ, USA
Posts: 10 gustavopeco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
When you submit a form, you can specify the method to be either POST or GET.. now it seems the difference among them is obvious, however ... what is the difference?

the search engine i created uses GET.. and basically I have a perl script which uses..
$CGI->param("fieldname").. to retrieve the stuff from the form, and then it takes this variable and puts into an SQL statement which is then sent to the mySQL database and processes and returns query.

Recently I've been trying to do the same thing, but instead of searching the database I want to add data to the database, using SQL insert statements.. Now I don't understand why my code doesn't work, because the script is able to extract the fields from the submited form and print them out on the screen.. however, the actual SQL statement doesn't execute because nothing gets added to a database.

So I was wondering, is this in anyway related to the GET/POST of the form. Theoretically GET shoudl work as long as its able to extract those variables.

I also don't get any error message regarding compilation errors or anything liek that.. so syntax is A-ok..

the SQL portion is as follows, why won't this addd to the database???

<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
#### attempt connection
$dbh = DBI->connect("DBI:mysql:$db", "$username", "$password");
#or die "can't connect to the database: $dbh->errstrn";

# this is the SQL statement the program executes
$statement = "INSERT INTO graphics (url, query, height, width, artistname, artisturl, email, category) VALUES ('$url', '$query', '$height', '$width', '$artistname', '$artisturl', '$email', '$category')";


#### The prepare and execute statement.
$sth = $dbh->prepare($statement);
$rv = $sth->execute;
[/code]


THanks

Reply With Quote
  #2  
Old September 6th, 2000, 11:04 PM
gustavopeco gustavopeco is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Piscataway, NJ, USA
Posts: 10 gustavopeco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I know this script connects to the database because i just copied and pasted the connection part from a script that actually works and interacts w/the database. so thtas not the problem.

Reply With Quote
  #3  
Old September 7th, 2000, 02:51 PM
supersalo supersalo is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 2 supersalo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try printing $statement (see what it contains)

Reply With Quote
  #4  
Old September 9th, 2000, 07:03 PM
JonLed JonLed is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2000
Location: Indiana
Posts: 614 JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level)JonLed User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 h 49 m 49 sec
Reputation Power: 14
You're forgetting that you have to view the sql error manually. it wont give a perl error:

#### The prepare and execute statement.
$sth = $dbh->prepare($statement) | | print "$dbh->errstr";
$rv = $sth->execute | | print "$dbh->errstr";

[This message has been edited by JonLed (edited September 09, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > POST vs GET

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap