Jump to content
Larry Ullman's Book Forums

sandari

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by sandari

  1. If you go to: http://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html you will find full instructions on loading time zones into MySQL
  2. 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.
  3. 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?
  4. Sorry guys but I am having trouble posting the screen shots. Anyway, when using the command line the first screen lists all the tables in the database. The table "award" does not show up. The second shows what happens when I try to create the table. It returns: ERROR 1050 (42S01): Table ''mwwg'.'award' already exists''
  5. This is the first screen shot for the previous post: This is the second screen shot:
  6. The table does not show up either in phpMyAdmin nor from the command line. This is a screen shot: and if I try to create it from the command line I get: What's going on??
  7. <code> CREATE TABLE IF NOT EXISTS `award` ( `award_id` int(11) NOT NULL AUTO_INCREMENT, `show_year` varchar(6) NOT NULL, `category_id` varchar(10) DEFAULT NULL, `category` varchar(100) DEFAULT NULL, `FirstPrize` varchar(40) DEFAULT NULL, `SecondPrize` varchar(40) DEFAULT NULL, `ThirdPrize` varchar(40) DEFAULT NULL, `FourthPrize` varchar(40) DEFAULT NULL, `HighlyCommended` varchar(40) DEFAULT NULL, PRIMARY KEY (`award_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=29 ; </code> When I run the above command I get the response: "#1050 - Table '`mwwg`.`award`' already exists" If I then run "show tables;" the table "award" does not show up. Any clues??
  8. Thanks for your input on this problem. It turned out that I had an error in the code where it had to decide whether Submitted was true or not. The program thought that Submitted was TRUE and just saved the variables back to the database and returned to the calling page. Thanks again.
  9. I give up!! What is wrong with this code? while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)){ echo "<tr class=\"data\" align=\"center\" width=\"100%\"> <form action=\"edit_other_medical_problem.php\" method=\"POST\"> <td align=\"center\">{$row['AssessmentDate']}</td> <td align=\"center\">{$row['MedicalProblem']}</td> <td align=\"center\">{$row['TreatmentPlan']}</td> <td align=\"center\">{$row['OtherDetails']}</td> <td align=\"center\"> <input type=\"submit\" name=\"submit\" value=\"Edit\"> <input type=\"hidden\" name=\"MedicalProblemID\" value=\"{$row['ID']}\"> </td> </form>"; echo "<form action=\"delete_other_medical_problem.php\" method=\"POST\"> <td align=\"center\"> <input type=\"submit\" name=\"submit\" value=\"Delete\"> <input type=\"hidden\" name=\"MedicalProblemID\" value=\"{$row['ID']}\"> </td> </form>"; echo "</tr>"; } The "Delete" button works beautifully but the "Edit" button remains on this page instead of opening "edit_other_medical_problem.php". I cannot see the difference.
  10. I have been using "PHP6 and MySQL5" for some time now and am reasonably comfortable with it. However, when looking for additional info on the web I often come accross the symbol "->". Can someone please explain, in detail, what this means and how it works. I look forward to being educated.
  11. i am sure the logic for this is quite simple. I just cannot see it. My pagination works relly well, too well in fact. I have a file that displays 10 records at a time. However, the pagination dispalys all 1643 page numbers. How do I limit the display to just 3 or 4 page numbers with ellipsis each side after moving beyond the initial 3 or 4 pages?
  12. Thanks Jaepee, It's too easy to make such a silly mistake like this. Took your advice and all is now good.
  13. Table structure is: ID int(11) Auto Primary Key Not NULL DetoxUnit varchar(255) Address1 varchar(255) Address2 varchar(255) Suburb int(11) Phone varchar(255) Fax varchar(255) Contact varchar(255) Command is: insert into tblDetoxUnits (DetoxUnit, Address1, Address2, Suburb, Phone, Fax, Contact) values('Dr Gumley\'s Sanitorium', '21 Acidic way', '', '13', '3210 9999', '3210 8888,' 'Michelle'); The error message is: Column count doesn't match value count at row 1 in C:\...\add_detox_unit.php on line 87 As far as I can see I am trying to insert 7 values into their 7 coresponding columns. What am I missing?
  14. Actually the backticks didn't make any difference but changing some of the field names did. My table structure is: now ID int(11) ClientID int(11) TypeOfProgram int(11) WhenRun varchar(255) WhereRun varchar(255) HowLong varchar(255) Thanks again for your help.
  15. My table structure is: ID int(11) ClientID int(11) ProgramType int(11) When varchar(255) Where varchar(255) HowLong varchar(255) The command is: insert into tblRehabilitationHistory (ClientID, ProgramType, When, Where, HowLong) values ('2', '1', '2009', 'Brisbane', '6 weeks'); The error message is: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'When, Where, HowLong) values ('2', '1', '2009', 'Brisbane', '6 weeks')' at line 1 I am at a loss to see where I have gone wrong. Any and all help will be appreciated.
  16. Thanks HartleySan, it works really well, particularly after I changed: if ($value === $DayCommenced) { to if ($value == $DayCommenced) { or did you put that in there to see if I was reading everything? :-) Anyway, all is good now. Thanks again for all your help.
  17. OK, maybe I didn't get exactly what you and Larry were saying. However, the previous was resolved quite easily as indicated in my last post in that thread. I have pulled the date from the DB in a single query at the start of this script and exploded the date into $DayCommenced, $MonthCommenced & $YearCommenced. The values are all correct right up until the lines quoted above. I think my problem is that I do not fully understand how to evaluate the individual keys in the $day array to be able to compare them to $DayCommenced, if, in fact, $day is an array. Please explain in detail. Sorry to be so thick on this one.
  18. I must be dumb. Similar code worked previously when making another drop-down list, however it does not work in the format below. Any help will be appreciated. <?php $DayCommenced= 16; $day=range(01,31); echo"<label>Commenced</label><br />"; echo"<select name=\"DayCommenced\">"; foreach($day as $value){ if($day==$DayCommenced){ $selected = "selected"; }else{ $selected = ""; } echo"<option value=\"$value\" $selected>$value</option>"; } echo "</select>"; ?>
  19. The problem turned out to be that the line: echo"<option value=\"{$row['suburb_id']}\" selected=$selected>{$row['suburb']} {$row['state']} {$row['postcode']}</option>"; Should have read: echo"<option value=\"{$row['suburb_id']}\" $selected>{$row['suburb']} {$row['state']} {$row['postcode']}</option>"; i.e. without the "selected=" Thanks for your help. All is now good.
  20. Thanks for your suggestions. I will look into it but I am starting to think the problem lies further back up in the code.
  21. OK, I've taken oput the foreach loop so the code now looks like this: <?php echo"<label>Suburb</label><br />"; echo"<select name=\"Suburb\">"; $query="select suburb_id, suburb, state, postcode from tblPostcodes order by suburb,state, postcode asc;"; $result=@mysqli_query($dbc,$query); while($row=mysqli_fetch_array($result,MYSQLI_ASSOC)){ if($row['suburb_id']==$suburb_id){ $selected="selected"; }else{ $selected=""; } echo"<option value=\"{$row['suburb_id']}\" selected=$selected> {$row['suburb']} {$row['state']} {$row['postcode']}</option>"; } echo"</select>"; ?> But it still goes straight to the last suburb in the list. Any help will be appreciated.
×
×
  • Create New...