Bryan Tolka wrote:

> I made a typo in my code. I am just a network admin. I am working on 
> my IP address maintenance system thats interacts with dhcp and dns. I 
> have also used PHP, but i just bgan using perl with mysql.  The 
> problem is updating several field with NULL or no values assigned.


Any help is appreciated. I will look into the books fellows.


>
>
> Bryan Tolka
>
>
> # check to see if oldip and ip do not match: delete old info
> if ($ip ne $oldip){
>    $sth = $dbh->prepare("update ipmgt set
>            ip = '$oldip'
>            hw = NULL ,
>            dnsName = NULL ,
>            userName = NULL,

                os= NULL,            
                dept= NULL,

>            notes= NULL,
>            bootType= NULL,
>            bootFile= NULL,
>            bootHost= NULL,
>            where ip = '$oldip'");
>
>
>    $sth = $dbh->prepare("update ipmgt set
>            ip = '$ip',
>            hw = '$hw',
>            dnsName = '$dnsName',              userName = '$userName',
>            os = '$os',
>            dept = '$dept',
>            notes = '$notes',
>            bootType = '$bootType',
>            bootFile = '$bootFile',
>            bootHost = '$bootHost'
>            where ip = '$ip'");
>
>  
>
>
>    $rc= $sth->execute;
>    $sth->finish;
>    $dbh->disconnect;
>    system ("/usr/bin/logger -t web-ip-update -p local3.info IP update 
> for $oldip changed to $ip, hw- $hw");
> }
> else {
>    $sth = $dbh->prepare("update ipmgt set
>            ip = '$ip',
>            hw = '$hw',
>            dnsName = '$dnsName',              userName = '$userName',
>            os = '$os',
>            dept = '$dept',
>            notes = '$notes',
>            bootType = '$bootType',
>            bootFile = '$bootFile',
>            bootHost = '$bootHost'
>
>            where
>            ip = '$ip'");
>      $rc= $sth->execute;
>    $sth->finish;
>    $dbh->disconnect;
>    system ("/usr/bin/logger -t web-ip-update -p local3.info IP update 
> for $ip, hw= $hw");
> }
> }
>
>>
>>
>>
>
>
>




Reply via email to