CGI MySql HTML Forms
I was trying to get data from html forms and then insert it into sql database
Code:
my $st=param('student'); But i got errors for that also Global symbol "%FORM" requires explicit package name I am new to perl scripting, i tried perldocs and perldoc site also but found it tough to understand, could some one please guide me or suggest a beginner book ? |
Quote:
But if that's your code, you seem to be missing the part where you open the connection to MySQL, and attach to the database. Code:
my $dsn = "DBI:mysql:<Database Name Goes Here>"; Code:
$dbh->do("INSERT INTO <Table Name> values (\"$variable1\",\"$variable2\")"); |
solved
I didnt put the whole code i only put the line where i got stuck ,
instead of having query in dbh->prepare I had a variable that holds my query , $query="INSERT INTO table values('$val1','$val2')"; now dbh->prepare($query) This worked fine now , iam trying to figure out why it cant be done straight forward as in my first post |
All times are GMT -5. The time now is 01:48 AM. |