Hi!
I have a problem (again). :-(
This script I wrote is supposed to update mysql table with new data. When I write in mysql: update table set nameMAC='something' where MAC='something else', everything works just fine. But my script just won't do it!
Here's my code, so if anyone can figure out what is it that I did wrong, please let me know!
Code:
_________________________
#! /usr/bin/perl
use CGI qwstandard);
use DBI;
$username = 'root';$password = '';$database = 'arp';$hostname = '';
$dbh = DBI->connect("dbi:mysql:database=$database;" .
"host=$hostname;port=3306", $username, );
my $q=new CGI;
$MAC=$q->param("id");
chomp($MAC);
print header;
print start_html(-title=>'Adding a NIC name',
-bgcolor=>"#EEEEEE");
print h1('Adding a NIC name'),
start_form,
"Type in your NIC name ",textfield('name'),
p,
submit (-name=>'imeMAC',
-value=>'Save'),
end_form,
hr;
my $name=$q->param('name');
print ($name); # this is just to check if $name contains what I want. It prints out exactly what I want in HTML.
$SQL="update promet set imeMAC='$name' where MAC='$MAC'";
$sql=$dbh->prepare($SQL);
$sql->execute();
print end_html;
_____________________________
Please, help!
I have a problem (again). :-(
This script I wrote is supposed to update mysql table with new data. When I write in mysql: update table set nameMAC='something' where MAC='something else', everything works just fine. But my script just won't do it!
Here's my code, so if anyone can figure out what is it that I did wrong, please let me know!
Code:
_________________________
#! /usr/bin/perl
use CGI qwstandard);
use DBI;
$username = 'root';$password = '';$database = 'arp';$hostname = '';
$dbh = DBI->connect("dbi:mysql:database=$database;" .
"host=$hostname;port=3306", $username, );
my $q=new CGI;
$MAC=$q->param("id");
chomp($MAC);
print header;
print start_html(-title=>'Adding a NIC name',
-bgcolor=>"#EEEEEE");
print h1('Adding a NIC name'),
start_form,
"Type in your NIC name ",textfield('name'),
p,
submit (-name=>'imeMAC',
-value=>'Save'),
end_form,
hr;
my $name=$q->param('name');
print ($name); # this is just to check if $name contains what I want. It prints out exactly what I want in HTML.
$SQL="update promet set imeMAC='$name' where MAC='$MAC'";
$sql=$dbh->prepare($SQL);
$sql->execute();
print end_html;
_____________________________
Please, help!