jerryisgood Posted August 3, 2010 Share Posted August 3, 2010 Okay, so I have a form and now I am trying to write the post data to a db. The thing is, the way the HTML was designed, I had to adopt a poor naming convention in order to satisfy some other requirements. I'm just getting into PHP.. Is it possible to assign PHP variables and then store these variables to my database instead? Right now, I have an e-mail sent to myself but it looks like gibberish.. So I started doing this $CostReadiness= $_POST['tfa_ReadinessCostEst']; $BudgetReadiness= $_POST['ReadinessBudgetc']; $Recommendations= $_POST['tfa_ReadinessITAsses']; and such for all of my entries.. Could I set up a table using these variables? Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/ Share on other sites More sharing options...
sspoke Posted August 3, 2010 Share Posted August 3, 2010 of course you can like something like this mysql_query("INSERT INTO test ('CostReadiness', 'BudgetReadiness','Recommendations') VALUES('$CostReadiness', '$BudgetReadiness', '$BudgetReadiness' ) ") or die(mysql_error()); create your mysql table anyway you want it to be named note you don't need to create variables even well after you checked them for injections you can simply do this. mysql_query("INSERT INTO test ('CostReadiness', 'BudgetReadiness','Recommendations') VALUES('{$_POST['tfa_ReadinessCostEst']}', '{$_POST['ReadinessBudgetc']}', '{$_POST['tfa_ReadinessITAsses']}' ) ") or die(mysql_error()); they will still get stored in database as CostReadiness BudgetReadiness Recommendations then you can read them up or email them any format you wish. Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094465 Share on other sites More sharing options...
jerryisgood Posted August 3, 2010 Author Share Posted August 3, 2010 Thank you for the quick response.. This is what I have now, before I read your post. Could you kindly tell me what is wrong with this? Should I redo it using your method? I'm not receiving any errors, but there is no activity in my db either. <? // Let's make sure our Terms of Service have been accepted, and if not, post an error // Identify PHP friendly variables by assosiating with the POST data if($_POST['tos'] != "on") { echo("<h2>You MUST accept the Terms of Service to submit this form</h2>"); die(); } //Let's connect to our database first so that the mySQL injection prevention can work properly $DBhost = "removed for forum"; $DBuser = "removed for forum"; $DBpass = "removed for forum"; $DBName = "jerryxhs"; mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); $Practice = $_POST['tfa_Name']; $Practice = mysql_real_escape_string($Practice); $TaxID = $_POST['tfa_TaxIDNoc']; $TaxID = mysql_real_escape_string($TaxID); $Specialties = $_POST['tfa_ProviderTypesc[]']; $Specialties = mysql_real_escape_string($Specialties); $PrimaryStreet = $_POST['tfa_BillingStreet']; $PrimaryStreet = mysql_real_escape_string($PrimaryStreet); $PrimaryCity = $_POST['tfa_BillingCity']; $PrimaryCity = mysql_real_escape_string($PrimaryCity); $PrimaryState = $_POST['tfa_BillingState']; $PrimaryState = mysql_real_escape_string($PrimaryState); $PrimaryZip = $_POST['tfa_BillingPostalCod']; $PrimaryZip = mysql_real_escape_string($PrimaryZip); $PrimaryPhone = $_POST['tfa_phone']; $PrimaryPhone = mysql_real_escape_string($PrimaryPhone); $PrimaryFax = $_POST['tfa_fax']; $PrimaryFax = mysql_real_escape_string($PrimaryFax); $OfficeHours = $_POST['tfa_OfficeHoursWeekD']; $OfficeHours = mysql_real_escape_string($OfficeHours); $OfficeAdminSalutation = $_POST['tfa_Salutation']; $OfficeAdminSalutation = mysql_real_escape_string($OfficeAdminSalutation); $OfficeAdminFirst = $_POST['tfa_FirstName']; $OfficeAdminFirst = mysql_real_escape_string($OfficeAdminFirst); $OfficeAdminLast = $_POST['tfa_LastName']; $OfficeAdminLast = mysql_real_escape_string($OfficeAdminLast); $OfficeAdminPhone = $_POST['tfa_Telephone']; $OfficeAdminPhone = mysql_real_escape_string($OfficeAdminPhone); $OfficeAdminFax = $_POST['tfa_Fax1']; $OfficeAdminFax = mysql_real_escape_string($OfficeAdminFax); $OfficeAdminEmail = $_POST['tfa_Email']; $OfficeAdminEmail = mysql_real_escape_string($OfficeAdminEmail); $ChampionSalutation = $_POST['tfa_Salutation1']; $ChampionSalutation = mysql_real_escape_string($ChampionSalutation); $ChampionFirst = $_POST['tfa_FirstName2']; $ChampionFirst = mysql_real_escape_string($ChampionFirst); $ChampionLast = $_POST['tfa_LastName2']; $ChampionLast = mysql_real_escape_string($ChampionLast); $ChampionPhone = $_POST['tfa_Telephone1']; $ChampionPhone = mysql_real_escape_string($ChampionPhone); $ChampionFax = $_POST['tfa_Fax2']; $ChampionFax = mysql_real_escape_string($ChampionFax); $ChampionEmail = $_POST['tfa_Email1']; $ChampionEmail = mysql_real_escape_string($ChampionEmail); $QualityImprovSalutation = $_POST['tfa_Salutation2']; $QualityImprovSalutation = mysql_real_escape_string($QualityImprovSalutation); $QualityImprovFirst = $_POST['tfa_FirstName3']; $QualityImprovFirst = mysql_real_escape_string($QualityImprovFirst); $QualityImprovLast = $_POST['tfa_LastName3']; $QualityImprovLast = mysql_real_escape_string($QualityImprovLast); $QualityImprovPhone = $_POST['tfa_Telephone2']; $QualityImprovPhone = mysql_real_escape_string($QualityImprovPhone); $QualityImprovFax = $_POST['tfa_Fax3']; $QualityImprovFax = mysql_real_escape_string($QualityImprovFax); $QualityImprovEmail = $_POST['tfa_Email2']; $QualityImprovEmail = mysql_real_escape_string($QualityImprovEmail); $ConsultantFirst = $_POST['tfa_FirstName4']; $ConsultantFirst = mysql_real_escape_string($ConsultantFirst); $ConsultantLast = $_POST['tfa_LastName4']; $ConsultantLast = mysql_real_escape_string($ConsultantLast); $InHouseCheck = $_POST['tfa_InHouse']; $InHouseCheck = mysql_real_escape_string($InHouseCheck); $ConsultantCheck = $_POST['tfa_Consultant']; $ConsultantCheck = mysql_real_escape_string($ConsultantCheck); $NoITPersonnel = $_POST['tfa_NoITPersonnel']; $NoITPersonnel = mysql_real_escape_string($NoITPersonnel); $ConsultantPhone = $_POST['tfa_Telephone3']; $ConsultantPhone = mysql_real_escape_string($ConsultantPhone); $ConsultantFax = $_POST['tfa_Fax4']; $ConsultantFax = mysql_real_escape_string($ConsultantFax); $ConsultantEmail = $_POST['tfa_Email3']; $ConsultantEmail = mysql_real_escape_string($ConsultantEmail); $ConsultantStreet = $_POST['tfa_StreetAddress']; $ConsultantStreet = mysql_real_escape_string($ConsultantStreet); $ConsultantCity = $_POST['tfa_City']; $ConsultantCity = mysql_real_escape_string($ConsultantCity); $ConsultantState = $_POST['tfa_State']; $ConsultantState = mysql_real_escape_string($ConsultantState); $ConsultantZip = $_POST['tfa_Zip']; $ConsultantZip = mysql_real_escape_string($ConsultantZip); $NumberEmployees = $_POST['tfa_NumberofEmployee']; $NumberEmployees = mysql_real_escape_string($NumberEmployees); $ProviderFirst = $_POST['tfa_FirstName1']; $ProviderFirst = mysql_real_escape_string($ProviderFirst); $ProviderLast = $_POST['tfa_LastName1']; $ProviderLast = mysql_real_escape_string($ProviderLast); $ProviderLicense = $_POST['tfa_LicenseType1']; $ProviderLicense = mysql_real_escape_string($ProviderLicense); $ProviderPrimSpecialty = $_POST['tfa_PrimarySpecialty1']; $ProviderPrimSpecialty = mysql_real_escape_string($ProviderPrimSpecialty); $ProviderSecondSpecialty = $_POST['tfa_SecondarySpecial']; $ProviderSecondSpecialty = mysql_real_escape_string($ProviderSecondSpecialty); $ProviderNYLicence = $_POST['tfa_NYStateLicenseNu1']; $ProviderNYLicense = mysql_real_escape_string($ProviderNYLicense); $ProviderDEA = $_POST['tfa_DEANumber1']; $ProviderDEA = mysql_real_escape_string($ProviderDEA); $ProviderNPI = $_POST['tfa_NPINumber1']; $ProviderNPI = mysql_real_escape_string($ProviderNPI); $ProviderEmail = $_POST['tfa_EmailAddress1']; $ProviderEmail = mysql_real_escape_string($ProviderEmail); $ProviderDaysWorked = $_POST['tfa_DaysPerWeek1']; $ProviderDaysWorked = mysql_real_escape_string($ProviderDaysWorked); $PrimaryProviderNinetyPercent = $_POST['tfa_Ifthisindividual']; $ProviderProviderNinetyPercent = mysql_real_escape_string($ProviderProviderNinetyPercent); $NumberSites = $_POST['tfa_NumberofSitesc']; $NumberSites = mysql_real_escape_string($NumberSites); $NumberProviders = $_POST['tfa_NumberofProvider']; $NumberProviders = mysql_real_escape_string($NumberProviders); $YearlyEncounters = $_POST['tfa_EncountersPerYea']; $YearlyEncounters = mysql_real_escape_string($YearlyEncounters); $NumberMedicalPatients = $_POST['tfa_NumberofMedicalP']; $NumberMedicalPatients = mysql_real_escape_string($NumberMedicalPatients); $FQHC = $_POST['tfa_FQHCc']; $FQHC = mysql_real_escape_string($FQHC); $Article28 = $_POST['tfa_Article28c']; $Article28 = mysql_real_escape_string($Article28); $Article16 = $_POST['tfa_Article16c']; $Article16 = mysql_real_escape_string($Article16); $PercentNYFunded = $_POST['tfa_PercentPatientso']; $PercentNYFunded = mysql_real_escape_string($PercentNYFunded); $PercentUninsured = $_POST['tfa_PercentPatientsU']; $PercentUninsured = mysql_real_escape_string($PercentUninsured); $PercentBelow200Poverty = $_POST['tfa_Percentbelow200P']; $PercentBelow200Poverty = mysql_real_escape_string($PercentBelow200Poverty); $PercentNonWhite = $_POST['tfa_PercentNonWhitec']; $PercentNonWhite = mysql_real_escape_string($PercentNonWhite); $PercentNonEnglish = $_POST['tfa_PercentOtherLang']; $PercentNonEnglish = mysql_real_escape_string($PercentNonEnglish); $PercentIlliterate = $_POST['tfa_PercentUnabletoR']; $PercentIlliterate = mysql_real_escape_string($PercentIlliterate); $PercentHIV = $_POST['tfa_PercentHIVc']; $PercentHIV = mysql_real_escape_string($PercentHIV); $PercentMRDD = $_POST['tfa_PercentMRDDc']; $PercentMRDD = mysql_real_escape_string($PercentMRDD); $PercentPediatric = $_POST['tfa_PercentPediatric']; $PercentPediatric = mysql_real_escape_string($PercentPediatric); $PercentWomenHealth = $_POST['tfa_PercentWomensHea']; $PercentWomenHealth = mysql_real_escape_string($PercentWomenHealth); $PercentGeriatric = $_POST['tfa_PercentGeriatric']; $PercentGeriatric = mysql_real_escape_string($PercentGeriatric); $Diagnosis1 = $_POST['tfa_Diagnosis1']; $Diagnosis1 = mysql_real_escape_string($Diagnosis1); $Diagnosis2 = $_POST['tfa_Diagnosis2']; $Diagnosis2 = mysql_real_escape_string($Diagnosis2); $Diagnosis3 = $_POST['tfa_Diagnosis3']; $Diagnosis3 = mysql_real_escape_string($Diagnosis3); $Diagnosis4 = $_POST['tfa_Diagnosis4']; $Diagnosis4 = mysql_real_escape_string($Diagnosis4); $Diagnosis5 = $_POST['tfa_Diagnosis5']; $Diagnosis5 = mysql_real_escape_string($Diagnosis5); $PrimaryLanguage = $_POST['tfa_PatientLanguage12']; $PrimaryLanguage = mysql_real_escape_string($PrimaryLanguage); $PercentSpeakPrimary = $_POST['tfa_Percentwhospeakl']; $PercentSpeakPrimary = mysql_real_escape_string($PercentSpeakPrimary); $SecondaryLanguage = $_POST['PatientLanguage1']; $SecondaryLanguage = mysql_real_escape_string($SecondaryLanguage); $PercentSpeakSecondary = $_POST['tfa_Percentwhospeakl1']; $PercentSpeakSecondary = mysql_real_escape_string($PercentSpeakSecondary); $PrimaryManagedCare = $_POST['tfa_ManagedCare1c']; $PrimaryManagedCare = mysql_real_escape_string($PrimaryManagedCare); $PercentPrimaryMC = $_POST['tfa_Percentcoveredby1']; $PercentPrimaryMC = mysql_real_escape_string($PercentPrimaryMC); $SecondaryManagedCare = $_POST['tfa_ManagedCare2c']; $SecondaryManagedCare = mysql_real_escape_string($SecondaryManagedCare); $PercentSecondaryMC = $_POST['tfa_Percentcoveredby2']; $PercentSecondaryMC = mysql_real_escape_string($PercentSecondaryMC); $TertiaryManagedCare = $_POST['tfa_ManagedCare3c']; $TertiaryManagedCare = mysql_real_escape_string($TertiaryManagedCare); $PercentTertiaryMC = $_POST['tfa_Percentcoveredby3']; $PercentTertiaryMC = mysql_real_escape_string($PercentTertiaryMC); $FourthManagedCare = $_POST['tfa_ManagedCare4c']; $FourthManagedCare = mysql_real_escape_string($FourthManagedCare); $PercentFourthMC = $_POST['tfa_Percentcoveredby4']; $PercentFourthMC = mysql_real_escape_string($PercentFourthMC); $FifthManagedCare = $_POST['tfa_ManagedCare5c']; $FifthManagedCare = mysql_real_escape_string($FifthManagedCare); $PercentFifthMC = $_POST['tfa_Percentcoveredby5']; $PercentFifthMC = mysql_real_escape_string($PercentFifthMC); $PrimaryLab = $_POST['tfa_PrimaryInterface']; $PrimaryLab = mysql_real_escape_string($PrimaryLab); $PercentPrimaryLab = $_POST['tfa_ofTestsOrderedTh']; $PercentPrimaryLab = mysql_real_escape_string($PercentPrimaryLab); $PrimaryLabAccnt = $_POST['tfa_PrimaryLabAccoun']; $PrimaryLabAccnt = mysql_real_escape_string($PrimaryLabAccnt); $SecondaryLab = $_POST['tfa_SecondaryInterfa']; $SecondaryLab = mysql_real_escape_string($SecondaryLab); $PercentSecondaryLab = $_POST['tfa_ofTestsOrderedTh1']; $PercentSecondaryLab = mysql_real_escape_string($PercentSecondatyLab); $SecondaryLabAccnt = $_POST['tfa_SecondaryLabAcco']; $SecondaryLabAccnt = mysql_real_escape_string($SecondaryLabAccnt); $TertiaryLab = $_POST['tfa_TertiaryInterfac']; $TertiaryLab = mysql_real_escape_string($TertiaryLab); $PercentTertiaryLab = $_POST['tfa_ofTestsOrderedTh2']; $PercentTertiaryLab = mysql_real_escape_string($PercentTertiaryLab); $TertiaryLabAccnt = $_POST['tfa_TertiaryLabAccoun']; $TertiaryLabAccnt = mysql_real_escape_string($TertiaryLabAccnt); $OtherLabs = $_POST['tfa_LabChosenc[]']; $OtherLabs = mysql_real_escape_string($OtherLabs); $UseClearingHouse = $_POST['tfa_DoyouuseaClearin']; $UseClearingHouse = mysql_real_escape_string($UseClearingHouse); $ClearingHouseName = $_POST['tfa_Whatisthenameofy']; $ClearingHouseName = mysql_real_escape_string($ClearingHouseName); $BillInHouseOrThirdParty = $_POST['tfa_Doyoubillinhouse']; $BillInHouseOrThirdParty = mysql_real_escape_string($BillInHouseOrThirdParty); $BillingFirstName = $_POST['tfa_FirstName5']; $BillingFirstName = mysql_real_escape_string($BillingFirstName); $BillingLastName = $_POST['tfa_LastName5']; $BillingLastName = mysql_real_escape_string($BillingLastName); $BillingPhone = $_POST['tfa_Telephone4']; $BillingPhone = mysql_real_escape_string($BillingPhone); $BillingFax = $_POST['tfa_Fax6']; $BillingFax = mysql_real_escape_string($BillingFax); $BillingEmail = $_POST['tfa_Email4']; $BillingEmail = mysql_real_escape_string($BillingEmail); $ReferralPracticeName = $_POST['tfa_PracticeName']; $ReferralPracticeName = mysql_real_escape_string($ReferralPracticeName); $RefProviderFirstName = $_POST['tfa_ProviderFirstNam']; $RefProviderFirstName = mysql_real_escape_string($RefProviderFirstName); $RefProviderLastName = $_POST['tfa_ProviderLastNam']; $RefProviderLastName = mysql_real_escape_string($RefProviderLastName); $ReferralSpecialty = $_POST['tfa_Specialty']; $ReferralSpecialty = mysql_real_escape_string($ReferralSpecialty); $ReferralPhone = $_POST['tfa_Phone1']; $ReferralPhone = mysql_real_escape_string($ReferralPhone); $ReferralFax = $_POST['tfa_Fax5']; $ReferralFax = mysql_real_escape_string($ReferralFax); $ReferralEmail = $_POST['tfa_EmailAddressifav']; $ReferralEmail = mysql_real_escape_string($ReferralEmail); $CIRviaEHR = $_POST['tfa_Doesyourpractice']; $CIRviaEHR = mysql_real_escape_string($CIRviaEHR); $CIRIDs = $_POST['tfa_PleaselistyourCI']; $CIRIDs = mysql_real_escape_string($CIRIDs); $EmailUseFrontDesk = $_POST['tfa_PrePCIPFrontDesk']; $EmailUseFrontDesk = mysql_real_escape_string($EmailUseFrontDesk); $EmailUseClinical = $_POST['tfa_PrePCIPClinicalE']; $EmailUseClinical = mysql_real_escape_string($EmailUseClinical); $BillingSoftware = $_POST['tfa_PrePCIPBillingSo']; $BillingSoftware = mysql_real_escape_string($BillingSoftware); $SchedulingSoftware = $_POST['tfa_PrePCIPSchedulin']; $SchedulingSoftware = mysql_real_escape_string($SchedulingSoftware); $EMREHR = $_POST['tfa_PrePCIPEMREHRc']; $EMREHR = mysql_real_escape_string($EMREHR); $ITReadiness = $_POST['ReadinessITpolic']; $ITReadiness = mysql_real_escape_string($ITReadiness); $HITReadiness = $_POST['tfa_ReadinessHIPAAc']; $HITReadiness = mysql_real_escape_string($HITReadiness); $SecurityReadiness = $_POST['tfa_ReadinessSecurit']; $SecurityReadiness = mysql_real_escape_string($SecurityReadiness); $CostReadiness = $_POST['tfa_ReadinessCostEst']; $CostReadiness = mysql_real_escape_string($CostReadiness); $BudgetReadiness = $_POST['ReadinessBudgetc']; $BudgetReadiness = mysql_real_escape_string($BudgetReadiness); $Recommendations = $_POST['tfa_ReadinessITAsses']; $Recommendations = mysql_real_escape_string($Recommendations); $ComputerReadiness = $_POST['tfa_ReadinessCompute']; $ComputerReadiness = mysql_real_escape_string($ComputerReadiness); $NonHITEndeavors = $_POST['tfa_ReadinessOtherEn']; $NonHITEndeavors = mysql_real_escape_string($NonHITEndeavors); $NewPractice = $_POST['tfa_ReadinessNewPrac']; $NewPractice = mysql_real_escape_string($NewPractice); $EHRAdminGoals = $_POST['tfa_1Whatareyourprac']; $EHRAdminGoals = mysql_real_escape_string($EHRAdminGoals); $EHRClinicalGoals = $_POST['tfa_2Whatareyourprac']; $EHRClinicalGoals = mysql_real_escape_string($EHRClinicalGoals); $StimulusStrategy = $_POST['tfa_3Withthefederalr']; $StimulusStrategy = mysql_real_escape_string($StimulusStrategy); $TOSCheck = $_POST['tos']; $TOSCheck = mysql_real_escape_string($TOSCheck); $ESignature = $_POST['tfa_ESig']; $ESignature = mysql_real_escape_string($ESignature); $ESignatureMail = $_POST['tfa_ESigMail']; $ESignatureMail = mysql_real_escape_string($ESignatureMail); $SalesPerson = $_POST['tfa_SalesPerson']; $SalesPerson = mysql_real_escape_string($SalesPerson); //Post these variables to our MYSQL database $DBhost = "removed for forum"; $DBuser = "removed for forum"; $DBpass = "removed for forum"; $DBName = "jerryxhs"; mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database"); @mysql_select_db("$DBName") or die("Unable to select database $DBName"); // Create table mysql_select_db("jerryxhs"); $sql = "CREATE TABLE information ( CompID int NOT NULL AUTO_INCREMENT, Practice varchar(60), TaxID varchar(60), Specialties varchar(60), PrimaryStreet varchar(60), PrimaryCity varchar(60), PrimaryState varchar(60), PrimaryZip varchar(5), PrimaryPhone varchar(60), PrimaryFax varchar(60), OfficeHours varchar(60), OfficeAdminSalutation varchar(60), OfficeAdminFirst varchar(60), OfficeAdminLast varchar(60), OfficeAdminPhone varchar(60), OfficeAdminFax varchar(60), OfficeAdminEmail varchar(60), ChampionSalutation varchar(60), ChampionFirst varchar(60), ChampionLast varchar(60), ChampionPhone varchar(60), ChampionFax varchar(60), ChampionEmail varchar(60), QualityImprovSalutation varchar(60), QualityImprovFirst varchar(60), QualityImprovLast varchar(60), QualityImprovPhone varchar(60), QualityImprovFax varchar(60), QualityImprovEmail varchar(60), ConsultantFirst varchar(60), ConsultantLast varchar(60), InHouseCheck varchar(60), ConsultantCheck varchar(60), NoITPersonnel varchar(60), ConsultantPhone varchar(60), ConsultantFax varchar(60), ConsultantEmail varchar(60), ConsultantStreet varchar(60), ConsultantCity varchar(60), ConsultantZip varchar(60), ConsultantZip varchar(60), NumberEmployees varchar(60), ProviderFirst varchar(60), ProviderLast varchar(60), ProviderLicense varchar(60), ProviderPrimSpecialty varchar(60), ProviderSecondSpecialty varchar(60), ProviderNYLicense varchar(60), ProviderDEA varchar(60), ProviderNPI varchar(60), ProviderEmail varchar(60), ProviderDaysWorked varchar(60), PrimaryProviderNinetyPercent varchar(60), NumberSites varchar(60), NumberProviders varchar(60), YearlyIncome varchar(60), NumberMedicalPatients varchar(60), FQHC varchar(60), Article28 varchar(60), Article16 varchar(60), PercentNYFunded varchar(60), PercentUninsured varchar(60), PercentBelow200Poverty varchar(60), PercentNonWhite varchar(60), PercentNonEnglish varchar(60), PercentIlliterate varchar(60), PercentHIV varchar(60), PercentMRDD varchar(60), PercentPediatric varchar(60), PercentWomenHealth varchar(60), PercentGeriatric varchar(60), Diagnosis1 varchar(60), Diagnosis2 varchar(60), Diagnosis3 varchar(60), Diagonosis4 varchar(60), Diagnosis5 varchar(60), PrimaryLanguage varchar(60), PercentSpeakPrimary varchar(60), PrimaryManagedCare varchar(60), PercentPrimaryMC varchar(60), SecondaryManagedCare varchar(60), PercentSecondaryMC varchar(60), TertiaryManagedCare varchar(60), PercentTertiaryMC varchar(60), FourthManagedCare varchar(60), PercentFourthMC varchar(60), FifthManagedCare varchar(60), PercentFifthMC varchar(60), PrimaryLab varchar(60), PercentPrimaryLab varchar(60), PrimaryLabAccnt varchar(60), SecondaryLab varchar(60), PercentSecondaryLab varchar(60), SecondaryLabAccnt varchar(60), TertiaryLab varchar(60), PercentTertiaryLab varchar(60), TertiaryLabAccnt varchar(60), OtherLabs varchar(60), UseClearingHouse varchar(60), ClearingHouseName varchar(60), BillInHouseOrThirdParty varchar(60), BillingFirstName varchar(60), BillingLastName varchar(60), BillingPhone varchar(60), BillingFax varchar(60), BillingEmail varchar(60), ReferralPracticeName varchar(60), RefProviderFirstName varchar(60), RefProviderLastName varchar(60), ReferralSpecialty varchar(60), ReferralPhone varchar(60), ReferralFax varchar(60), ReferralEmail varchar(60), CIRviaEHR varchar(60), CIRIDs varchar(60), EmailUseFrontDesk varchar(60), EmailUseClinical varchar(60), BillingSoftware varchar(60), SchedulingSoftware varchar(60), EMREHR varchar(60), ITReadiness varchar(60), HITReadiness varchar(60), SecurityReadiness varchar(60), CostReadiness varchar(60), BudgetReadiness varchar(60), Recommendations varchar(60), ComputerReadiness varchar(60), NonHITEndeavors varchar(60), NewPractice varchar(60), EHRAdminGoals varchar(60), EHRClinicalGoals varchar(60), StimulusStrategy varchar(60), TOSCheck varchar(60), ESignature varchar(60), ESignatureMail varchar(60), SalesPerson varchar(60), )"; $sqlquery = "INSERT INTO information (id, Practice, TaxID, Specialties, PrimaryStreet, PrimaryCity, PrimaryState, PrimaryZip, PrimaryPhone, PrimaryFax, OfficeHours, OfficeAdminSalutation, OfficeAdminFirst, OfficeAdminLast, OfficeAdminPhone, OfficeAdminFax, OfficeAdminEmail, ChampionSalutation, ChampionFirst, ChampionLast, ChampionPhone, ChampionFax, ChampionEmail, QualityImprovSalutation, QualityImprovFirst, QualityImprovLast, QualityImprovPhone, QualityImprovFax, QualityImprovEmail, ConsultantFirst, ConsultantLast, InHouseCheck, ConsultantCheck, NoITPersonnel, ConsultantPhone, ConsultantFax, ConsultantEmail, ConsultantStreet, ConsultantCity, ConsultantZip, ConsultantZip, NumberEmployees, ProviderFirst, ProviderLast, ProviderLicense, ProviderPrimSpecialty, ProviderSecondSpecialty, ProviderNYLicense, ProviderDEA, ProviderNPI, ProviderEmail, ProviderDaysWorked, PrimaryProviderNinetyPercent, NumberSites, NumberProviders, YearlyIncome, NumberMedicalPatients, FQHC, Article28, Article16, PercentNYFunded, PercentUninsured, PercentBelow200Poverty, PercentNonWhite, PercentNonEnglish, PercentIlliterate, PercentHIV, PercentMRDD, PercentPediatric, PercentWomenHealth, PercentGeriatric, Diagnosis1, Diagnosis2, Diagnosis3, Diagonosis4, Diagnosis5, PrimaryLanguage, PercentSpeakPrimary, PrimaryManagedCare, PercentPrimaryMC, SecondaryManagedCare, PercentSecondaryMC, TertiaryManagedCare, PercentTertiaryMC, FourthManagedCare, PercentFourthMC, FifthManagedCare, PercentFifthMC, PrimaryLab, PercentPrimaryLab, PrimaryLabAccnt, SecondaryLab, PercentSecondaryLab, SecondaryLabAccnt, TertiaryLab, PercentTertiaryLab, TertiaryLabAccnt, OtherLabs, UseClearingHouse, ClearingHouseName, BillInHouseOrThirdParty, BillingFirstName, BillingLastName, BillingPhone, BillingFax, BillingEmail, ReferralPracticeName, RefProviderFirstName, RefProviderLastName, ReferralSpecialty, ReferralPhone, ReferralFax, ReferralEmail, CIRviaEHR, CIRIDs, EmailUseFrontDesk, EmailUseClinical, BillingSoftware, SchedulingSoftware, EMREHR, ITReadiness, HITReadiness, SecurityReadiness, CostReadiness, BudgetReadiness, Recommendations, ComputerReadiness, NonHITEndeavors, NewPractice, EHRAdminGoals, EHRClinicalGoals, StimulusStrategy, TOSCheck, ESignature, ESignatureMail, SalesPerson) VALUES('''$id','$Practice','$TaxID','$Specialties','$PrimaryStreet','$PrimaryCity' ,'$PrimaryState','$PrimaryZip','$PrimaryPhone','$PrimaryFax','$OfficeHours' ,'$OfficeAdminSalutation','$OfficeAdminFirst','$OfficeAdminLast' ,'$OfficeAdminPhone','$OfficeAdminFax','$OfficeAdminEmail' ,'$ChampionSalutation','$ChampionFirst','$ChampionLast','$ChampionPhone' ,'$ChampionFax','$ChampionEmail','$QualityImprovSalutation' ,'$QualityImprovFirst','$QualityImprovLast','$QualityImprovPhone' ,'$QualityImprovFax','$QualityImprovEmail','$ConsultantFirst' ,'$ConsultantLast','$InHouseCheck','$ConsultantCheck','$NoITPersonnel' ,'$ConsultantPhone','$ConsultantFax','$ConsultantEmail','$ConsultantStreet' ,'$ConsultantCity','$ConsultantZip','$ConsultantZip','$NumberEmployees' ,'$ProviderFirst','$ProviderLast','$ProviderLicense' ,'$ProviderPrimSpecialty','$ProviderSecondSpecialty','$ProviderNYLicense' ,'$ProviderDEA','$ProviderNPI','$ProviderEmail','$ProviderDaysWorked' ,'$PrimaryProviderNinetyPercent','$NumberSites','$NumberProviders' ,'$YearlyIncome','$NumberMedicalPatients','$FQHC','$Article28' ,'$Article16','$PercentNYFunded','$PercentUninsured' ,'$PercentBelow200Poverty','$PercentNonWhite','$PercentNonEnglish' ,'$PercentIlliterate','$PercentHIV','$PercentMRDD','$PercentPediatric' ,'$PercentWomenHealth','$PercentGeriatric','$Diagnosis1','$Diagnosis2' ,'$Diagnosis3','$Diagonosis4','$Diagnosis5','$PrimaryLanguage' ,'$PercentSpeakPrimary','$PrimaryManagedCare','$PercentPrimaryMC' ,'$SecondaryManagedCare','$PercentSecondaryMC','$TertiaryManagedCare' ,'$PercentTertiaryMC','$FourthManagedCare','$PercentFourthMC' ,'$FifthManagedCare','$PercentFifthMC','$'PrimaryLab,'$PercentPrimaryLab' ,'$PrimaryLabAccnt','$SecondaryLab','$PercentSecondaryLab' ,'$SecondaryLabAccnt','$TertiaryLab','$PercentTertiaryLab' ,'$TertiaryLabAccnt','$OtherLabs','$UseClearingHouse','$ClearingHouseName' ,'$BillInHouseOrThirdParty','$BillingFirstName','$BillingLastName' ,'$BillingPhone','$BillingFax','$'BillingEmail','$ReferralPracticeName' ,'$RefProviderFirstName','$RefProviderLastName','$ReferralSpecialty' ,'$ReferralPhone','$ReferralFax','$ReferralEmail','$CIRviaEHR','$CIRIDs' ,'$EmailUseFrontDesk','$EmailUseClinical','$BillingSoftware' ,'$SchedulingSoftware','$EMREHR','$ITReadiness','$HITReadiness' ,'$SecurityReadiness','$CostReadiness','$BudgetReadiness','$Recommendations' ,'$ComputerReadiness','$NonHITEndeavors','$NewPractice','$EHRAdminGoals' ,'$EHRClinicalGoals','$StimulusStrategy','$TOSCheck','$ESignature' ,'$ESignatureMail','$SalesPerson')"; $results = mysql_query($sqlquery); echo $results; mysql_close(); // Done. ?> From what I've gathered, I've done a lot of extra unnecessary work in turning those all into variables. Shouldn't it still work in this fashion though? I'm not sure what I'm doing wrong, Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094778 Share on other sites More sharing options...
iJoseph Posted August 3, 2010 Share Posted August 3, 2010 O.o I don't think anybody is going to look through all of that for errors. Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094780 Share on other sites More sharing options...
jerryisgood Posted August 3, 2010 Author Share Posted August 3, 2010 O.o I don't think anybody is going to look through all of that for errors. I'm sorry, I wasn't asking for a list of errors. I was just wondering if there was something that stuck out as incorrect, I don't know. I was just having trouble getting this to work but haven't been receiving any errors. Any errors I did encounter I tried to address. I guess I meant, rudimentary, is there anything that sticks out? Again, my apologies if I asked for too much or anything. I figured I would post my code here while I continued to work on it myself in hopes that maybe someone would look through it in their spare time. Thanks though. J Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094787 Share on other sites More sharing options...
jdavidbakr Posted August 3, 2010 Share Posted August 3, 2010 It doesn't look like you're executing the "create table" statement, although you probably should create the table outside of your form submission script. If you continue to run into issues, after each query add: echo "<P>".mysql_error()."</P>" and see if you get any output. Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094807 Share on other sites More sharing options...
jerryisgood Posted August 3, 2010 Author Share Posted August 3, 2010 It doesn't look like you're executing the "create table" statement, although you probably should create the table outside of your form submission script. If you continue to run into issues, after each query add: echo "<P>".mysql_error()."</P>" and see if you get any output. I had actually wanted to make my table outside of the script but had some troubles. I am using GoDaddy as a host and it keeps timing out every time I begin writing the table which has 140 inputs. Can I write this in Excel or something else and then somehow upload it to my server to prevent this from happening? Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094819 Share on other sites More sharing options...
PFMaBiSmAd Posted August 3, 2010 Share Posted August 3, 2010 You should be developing and debugging this on a local development system and only put it onto a live server once it is complete and tested. It should also take at most a few seconds for your entire script to run, assuming that your connection to the database server is occurring without error. Also, when you are learning or developing a new application, you do it in steps. You make your form and check that the form data was received correctly. Then you do any setup code necessary for the database. Then you finally process the data and form the query. Lastly, you put in the code to execute the query. Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094821 Share on other sites More sharing options...
PFMaBiSmAd Posted August 3, 2010 Share Posted August 3, 2010 Also, your CREATE TABLE query contains the following errors (you must use error checking and error reporting logic in your code at all times) - 1) There is an extra comma near the end, right before the final ) 2) The ConsultantZip column is duplicated 3) You haven't defined the AUTO_INCREMENT column as a primary key Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094825 Share on other sites More sharing options...
PFMaBiSmAd Posted August 3, 2010 Share Posted August 3, 2010 There's also about 5-6 errors in the INSERT query that using mysql_error() in some error checking and error reporting code will help you find. Quote Link to comment https://forums.phpfreaks.com/topic/209630-new-to-php-question-about-storing-variables-in-a-db/#findComment-1094829 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.