Jump to content

hyperdallas

Members
  • Posts

    12
  • Joined

  • Last visited

hyperdallas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ok great... could someone help with this?? ^^^ considering im still learning ?
  2. create works only for the original fields on the form and not the new ones i added. when i hit update, it wipes the data entered into the new fields and not saves it - everything else it saves.
  3. That'll work - good point DaveyK.. Thanks mate... Here is the code.. here are the fields I have added: softver epl eal exe if(isset($_REQUEST['action'])){ if($user->WriteAccess&&(($dev->DeviceID >0)&&($_REQUEST['action']=='Update'))){ $dev->Label=$_REQUEST['label']; $dev->SerialNo=$_REQUEST['serialno']; $dev->AssetTag=$_REQUEST['assettag']; $dev->Owner=$_REQUEST['owner']; $dev->EscalationTimeID=$_REQUEST['escalationtimeid']; $dev->EscalationID=$_REQUEST['escalationid']; $dev->PrimaryContact=$_REQUEST['primarycontact']; $dev->Cabinet=$_REQUEST['cabinetid']; $dev->Position=$_REQUEST['position']; $dev->Height=$_REQUEST['height']; $dev->TemplateID=$_REQUEST['templateid']; $dev->DeviceType=$_REQUEST['devicetype']; $dev->MfgDate=date('Y-m-d',strtotime($_REQUEST['mfgdate'])); $dev->InstallDate=date('Y-m-d',strtotime($_REQUEST['installdate'])); $dev->WarrantyCo=$_REQUEST['warrantyco']; $dev->WarrantyExpire=date('Y-m-d',strtotime($_REQUEST['warrantyexpire'])); // All of the values below here are optional based on the type of device being dealt with $dev->ChassisSlots=(isset($_REQUEST['chassisslots']))?$_REQUEST['chassisslots']:0; $dev->RearChassisSlots=(isset($_REQUEST['rearchassisslots']))?$_REQUEST['rearchassisslots']:0; $dev->Ports=(isset($_REQUEST['ports']))?$_REQUEST['ports']:""; $dev->PowerSupplyCount=(isset($_REQUEST['powersupplycount']))?$_REQUEST['powersupplycount']:""; $dev->ParentDevice=(isset($_REQUEST['parentdevice']))?$_REQUEST['parentdevice']:""; $dev->PrimaryIP=(isset($_REQUEST['primaryip']))?$_REQUEST['primaryip']:""; $dev->SNMPCommunity=(isset($_REQUEST['snmpcommunity']))?$_REQUEST['snmpcommunity']:""; $dev->ESX=(isset($_REQUEST['esx']))?$_REQUEST['esx']:0; $dev->Reservation=(isset($_REQUEST['reservation']))?$_REQUEST['reservation']:0; $dev->NominalWatts=$_REQUEST['nominalwatts']; $dev->SoftVer=$_REQUEST['softver']; $dev->EPL=$_REQUEST['epl']; $dev->EAL=$_REQUEST['eal']; $dev->EXEMPT=$_REQUEST['exe']; if(($dev->TemplateID >0)&&(intval($dev->NominalWatts==0))){$dev->UpdateWattageFromTemplate($facDB);} if($dev->Cabinet <0){ $dev->MoveToStorage($facDB); }else{ $dev->UpdateDevice($facDB); } }elseif($user->WriteAccess&&($_REQUEST['action']=='Create')){ $dev->Label=$_REQUEST['label']; $dev->SerialNo=$_REQUEST['serialno']; $dev->AssetTag=$_REQUEST['assettag']; $dev->Owner=$_REQUEST['owner']; $dev->EscalationTimeID=$_REQUEST['escalationtimeid']; $dev->EscalationID=$_REQUEST['escalationid']; $dev->PrimaryContact=$_REQUEST['primarycontact']; $dev->Cabinet=$_REQUEST['cabinetid']; $dev->Position=$_REQUEST['position']; $dev->Height=$_REQUEST['height']; $dev->Ports=$_REQUEST['ports']; $dev->TemplateID=$_REQUEST['templateid']; $dev->DeviceType=$_REQUEST['devicetype']; $dev->MfgDate=date('Y-m-d',strtotime($_REQUEST['mfgdate'])); $dev->InstallDate=date('Y-m-d',strtotime($_REQUEST['installdate'])); $dev->WarrantyCo=$_REQUEST['warrantyco']; $dev->WarrantyExpire=date('Y-m-d',strtotime($_REQUEST['warrantyexpire'])); $dev->Notes=$_REQUEST['notes']; $dev->SoftVer=$_REQUEST['softver']; $dev->EPL=$_REQUEST['epl']; $dev->EAL=$_REQUEST['eal']; $dev->Exempt=$_REQUEST['exe']; // All of the values below here are optional based on the type of device being dealt with $dev->ChassisSlots=(isset($_REQUEST['chassisslots']))?$_REQUEST['chassisslots']:0; $dev->RearChassisSlots=(isset($_REQUEST['rearchassisslots']))?$_REQUEST['rearchassisslots']:0; $dev->Ports=(isset($_REQUEST['ports']))?$_REQUEST['ports']:""; $dev->PowerSupplyCount=(isset($_REQUEST['powersupplycount']))?$_REQUEST['powersupplycount']:""; $dev->ParentDevice=(isset($_REQUEST['parentdevice']))?$_REQUEST['parentdevice']:""; $dev->PrimaryIP=(isset($_REQUEST['primaryip']))?$_REQUEST['primaryip']:""; $dev->SNMPCommunity=(isset($_REQUEST['snmpcommunity']))?$_REQUEST['snmpcommunity']:""; $dev->ESX=(isset($_REQUEST['esx']))?$_REQUEST['esx']:0; $dev->Reservation=(isset($_REQUEST['reservation']))?$_REQUEST['reservation']:0; $dev->CreateDevice($facDB); }elseif($user->DeleteAccess&&($_REQUEST['action']=='Delete')){ $dev->GetDevice($facDB); $dev->DeleteDevice($facDB); header('Location: '.redirect("cabnavigator.php?cabinetid=$dev->Cabinet")); exit; }elseif($user->WriteAccess&&$_REQUEST['action']=='child'){ if(isset($_REQUEST['parentdevice'])){ $dev->DeviceID=null; $dev->ParentDevice=$_REQUEST["parentdevice"]; } // sets install date to today when a new device is being created $dev->InstallDate=date("m/d/Y"); } } // Finished updating devices or creating them. Refresh the object with data from the DB $dev->GetDevice($facDB);
  4. Nope.. I have just customised an existing opensource application.. OpenDCIM - Open Source Data Center Inventory Management http://www.opendcim.org
  5. Thats exactly the problem. since i am still learning, i cant give you the snippet because i dont know where the functions are being performed.
  6. I tried, but the forums say its too long
  7. I have taken an existing form from an open source application im customising and have added a few extra variables that I am trying to have the script include when updating the form. Unfortunately I cant get it updating the new fields no matter how hard I try. My code is attached. The New Fields added are: Form Name Database field name Software Version -> softver EPL -> epl EAL -> eal Exempt -> Exempt Any help offered would be amazingly appreciated. Thanks devices.php
  8. your code causes: Parse error: syntax error, unexpected '{' in C:\xampp\htdocs\report_certification.php on line 33 while (($row=mysql_fetch_assoc($result))!==FALSE {
  9. Thanks awjudd... but no good. any ideas??? the idea of the query is to select all and list the detail... Here is the error: Unknown column 'd.label' in 'field list' Here is the php script: <html> <body> <?php $username="root"; $password=""; $database="db"; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT `d.label` , `d.exe` , `d.eal` , `d.epl` , `dt.Model` , `m.Manufacturer` FROM `fac_Device` AS d JOIN `fac_DeviceTemplate` AS dt ON `d.TemplateID` = dt.TemplateID JOIN `fac_Manufacturer` AS m ON `dt.ManufacturerID` = `m.ManufacturerID`"; $result=mysql_query($query)or die(mysql_error()); $num=mysql_numrows($result)or die(mysql_error()); mysql_close(); ?> <IMG SRC="http://localhost/dcim/images/logo.png"></IMG> <table border="0" cellspacing="2" cellpadding="2"> <tr> <h2><B>Report<BR></h2></B> <b></B><BR><BR> <td><B><font face="Arial, Helvetica, sans-serif">Device Name</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">Model</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">Manufacturer</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">OS Version</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">EPL</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">EAL</font></B></td> <td><B><font face="Arial, Helvetica, sans-serif">EXEMPT</font></B></td> </tr> <?php $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"d.label"); $f2=mysql_result($result,$i,"dt.Model"); $f3=mysql_result($result,$i,"m.manufacturer"); $f4=mysql_result($result,$i,"d.softver"); $f5=mysql_result($result,$i,"d.epl"); $f6=mysql_result($result,$i,"d.eal"); $f7=mysql_result($result,$i,"d.exe"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f1; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f2; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f3; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f4; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f5; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f6; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><?php echo $f7; ?></font></td> </tr> <?php $i++; } ?> </body> </html>
  10. I'm new to PHP and learning more and more everyday the more I play with things. I'm trying to write a MYSQL statement to output all results via php to a page. I have the PHP code sweet, but having some dramas trying to compose the SQL query. Here is what I am trying to achieve.. The lines are the relationships between fields. Could someone gimme a hand writing an SQL statement to satisfy this? Thanks heaps!! I have tried for a few days to do this and research, but its not getting me anywhere. Thanks.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.