sandari 1 Posted August 19, 2014 Report Share Posted August 19, 2014 I have query in PHP as follows: <code> $query="update tblClients SET GivenName1='$GivenName1', GivenName2='$GivenName2', PreferredName='$PreferredName', Surname='$Surname', DoB='$DoB', Gender='$Gender', PlaceOfBirth='$PlaceOfBirth', Address1='$Address1', Address2='$Address2', Suburb='$Suburb_id', Phone='$Phone', Source='$Source', ReferredBy='$ReferredBy', email='$Email', OptOut='$OptOut', WrongAddress='$WrongAddress', Campus='$Campus', FirstContact='$FirstContact', Merde='$Merde', Inactive='$Inactive', CRN='$CRN', AdmissionPack='$AdmissionPack', AdmissionProcedure='$AdmissionProcedure', AdmittedBy='$AdmittedBy', ResidencyContract='$ResidencyContract', ContractSigned='$ContractSigned', ContractWitnessed='$ContractWitnessed, DateContractSigned='$DateContractSigned', KeyDepositReceived='$KeyDepositReceived', KeyDepositRefunded='$KeyDepositRefunded', ReceiptDate='$ReceiptDate', RefundDate='$RefundDate', PreviousClient='$PreviousClient', PreviousCampus='$PreviousCampus', PreviousAdmission='$PreviousAdmission' where (ID='$ClientID');"; </code> The problem is that when I echo the query to the screen, copy it and paste it into the command line of MySQL it returns what looks like: '> Any suggestions? Quote Link to post Share on other sites
Emilie 19 Posted August 19, 2014 Report Share Posted August 19, 2014 Hello, MySQL doesn't 'know' the variables you created with PHP. In order to test your query, you need to replace the variables with their values. I hope this helps, Emilie 3 Quote Link to post Share on other sites
sandari 1 Posted August 20, 2014 Author Report Share Posted August 20, 2014 Thanks. I'll have anothr look at it. Quote Link to post Share on other sites
sandari 1 Posted August 20, 2014 Author Report Share Posted August 20, 2014 All fields are correct as are the data types. The code being sent is as follows: update tblClients SET GivenName1='Susanna', GivenName2='Anastasia', PreferredName='Susie', Surname='Barishnakov', DoB='1995-10-25', Gender='Female', PlaceOfBirth='', Address1='', Address2='', Suburb='8836', Phone='', Source='', ReferredBy='', email='', OptOut='0', WrongAddress='0', Campus='2', FirstContact='2012-10-25', Merde='0', Inactive='0', CRN='', AdmissionPack='0', AdmissionProcedure='0', AdmittedBy='', ResidencyContract='0', ContractSigned='0', ContractWitnessed='0, DateContractSigned='0000-00-00', KeyDepositReceived='0', KeyDepositRefunded='0', ReceiptDate='2012-10-25', RefundDate='0000-00-00', PreviousClient='0', PreviousCampus='2', PreviousAdmission='0000-00-00' where (ID='23'); But still I get '> as a response. Quote Link to post Share on other sites
Emilie 19 Posted August 20, 2014 Report Share Posted August 20, 2014 Hello, Another typo: ContractWitnessed='0, The closing quotation mark is missing. Also, if your ID is numeric, you should not quote it: where (ID='23') If this doesn't do the trick, I would suggest testing a few lines only at a time, until you find where the query goes wrong. I hope this helps, Emilie 3 Quote Link to post Share on other sites
Larry 428 Posted August 20, 2014 Report Share Posted August 20, 2014 Thanks for helping out, Emilie! I really appreciate it. Quote Link to post Share on other sites
sandari 1 Posted August 28, 2014 Author Report Share Posted August 28, 2014 Thanks for your help. It's amazing what a missing ' will do. Quote Link to post Share on other sites
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.
Note: Your post will require moderator approval before it will be visible.