Search the Community
Showing results for tags 'php pdo mysql'.
-
I am attempting to insert data into two tables with a single function. Currently I can enter into one table, but not the other. Anyone have advice or see anything wrong? public function createlog($logDay,$logMonth,$logYear,$logCaptain,$logEmployer,$logLocation,$logWeather,$logSeaCondition,$logVisibility,$logWind,$logRunningTime,$logStandByTime,$logDownTime,$logMate,$logEngineer,$logDeckhand,$logDeckhand2,$logCook,$logAccidents,$logCaptainRemarks,$logFuelOnBoardPrevious,$logFuelReceived,$logFuelTotal,$logFuelUsed,$logFuelTransferred,$logMeterClosing,$logMeterOpening,$logMeterPumped,$logFuelOnBoardPrevious,$logLubeReceived,$logLubeTotal,$logLubeUsed,$logLubeOnBoardEnd,$logHoursOnLubePort,$logHoursOnLubeStbd,$totalHoursOnEnginePort,$totalHoursOnEngineStbd,$vesselName,$vesselNumber,$vesselType,$vesselOwner,$table,$table2){ $sql = "INSERT INTO $table2 SET vesselName=:vesselName,vesselNumber=:vesselNumber,vesselType=:vesselType,vesselOwner=:vesselOwner"; $q = $this->conn->prepare($sql); $q->execute(array(':vesselName'=>$vesselName,':vesselNumber'=>$vesselNumber,':vesselType'=>$vesselType,':vesselOwner'=>$vesselOwner)); $sql = "INSERT INTO $table SET logDay=:logDay,logMonth=:logMonth,logYear=:logYear,logCaptain=:logCaptain,logEmployer=:logEmployer,logLocation=:logLocation,logWeather=:logWeather,logSeaCondition=:logSeaCondition,logVisibility=:logVisibility,logWind=:logWind,logRunningTme=:logRunningTime,logStandByTime=:logStandByTime,logDownTime=:logDownTime,logMate=:logMate,logEngineer=:logEngineer,logDeckhand=:logDeckhand,logDeckhand2=:logDeckhand2,logCook=:logCook,logAccidents=:logAccidents,logCaptainRemarks=:logCaptainRemarks,logFuelOnBoardPrevious=:logFuelOnBoardPrevious,logFuelReceived=:logFuelReceived,logFuelTotal=:logFuelTotal,logFuelUsed=:logFuelUsed,logFuelTransferred=:logFuelTransferred,logMeterClosing=:logMeterClosing,logMeterOpening=:logMeterOpening,logMeterPumped=:logMeterPumped,logFuelOnBoardPrevious=:logFuelOnBoardPrevious,logLubeReceived=:logLubeReceived,logLubeTotal=:logLubeTotal,logLubeUsed=:logLubeUsed,logLubeOnBoardEnd=:logLubeOnBoardEnd,logHoursOnLubePort=:logHoursOnLubePort,logHoursOnLubeStbd=:logHoursOnLubeStbd,totalHoursOnEnginePort=:totalHoursOnEnginePort,totalHoursOnEngineStbd=:totalHoursOnEngineStbd"; $q = $this->conn->prepare($sql); $q->execute (array(':logDay'=>$logDay,':logMonth'=>$logMonth,':logYear'=>$logYear,':logCaptain'=>$logCaptain,':logEmployer'=>$logEmployer,':logLocation'=>$logLocation,':logWeather'=>$logWeather,':logSeaCondition'=>$logSeaCondition,':logVisibility'=>$logVisibility,':logWind'=>$logWind,':logRunningTime'=>$logRunningTime,':logStandByTime'=>$logStandByTime,':logDownTime'=>$logDownTime,':logMate'=>$logMate,':logEngineer'=>$logEngineer,':logDeckhand'=>$logDeckhand,':logDeckhand2'=>$logDeckhand2,':logCook'=>$logCook,':logAccidents'=>$logAccidents,':logCaptainRemarks'=>$logCaptainRemarks,':logFuelOnBoardPrevious'=>$logFuelOnBoardPrevious,':logFuelReceived'=>$logFuelReceived,':logFuelTotal'=>$logFuelTotal,':logFuelUsed'=>$logFuelUsed,':logFuelTransferred'=>$logFuelTransferred,':logMeterClosing'=>$logMeterClosing,':logMeterOpening'=>$logMeterOpening,':logMeterPumped'=>$logMeterPumped,':logFuelOnBoardPrevious'=>$logFuelOnBoardPrevious,':logLubeReceived'=>$logLubeReceived,':logLubeTotal'=>$logLubeTotal,':logLubeUsed'=>$logLubeUsed,':logLubeOnBoardEnd'=>$logLubeOnBoardEnd,':logHoursOnLubePort'=>$logHoursOnLubePort,':logHoursOnLubeStbd'=>$logHoursOnLubeStbd,':totalHoursOnEnginePort'=>$totalHoursOnEnginePort,':totalHoursOnEngineStbd'=>$totalHoursOnEngineStbd)); return true; }