Jump to content
Larry Ullman's Book Forums

axiom28

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by axiom28

  1. I am a nooby so some guidance would help. I am going through Larry's book on Chapter 6 where this subject of FOREIGN KEYS starts. I am trying the create the transactions table but get the error #1215 - Cannot add foreign key constraint This error came up using PHPMyAdmin, I tried using the command prompt which also failed, but the error message there was too vague, I rechecked and retyped the code several times with the same result. Is there possibly a typo in the book, what else could be wrong? I have been stuck here for a few days I need to move to the end of the chapter and more. Ian
  2. Hi Larry, Thanks for your reply the error somehow seems to have resolved itself so I moved on through your book,
  3. Hi, I am now going through the SQL part of the above mentioned book, I tried to create the table "users" using the mySQL client command window and I kept getting an error message 1064, endless searches through google kept telling me there was something wrong with the syntax, yet I entered it exactly as in the book (several times). What was exactly wrong with the syntax I couldn't tell except that it has something to do with the first line user_id MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, I then tried using PHPmyAdmin which also wouldn't work, with a lot of experimentation i changed user_id to userid, then everything worked perfectly, can anyone tell me why this is, is user_id a built in key phrase I shouldn't use, is my version wrong (too old (5.6.17)). Anyway an explanation would help. Ian
  4. It's me again, I cannot believe that I made such a stupid mistake, I took a second look at my post, and then a second look at my code, there is nothing wrong with the code in the book if you type it in correctly the whole statement to advise people that they had forgotten to enter their gender was there, here's the faulty part: if ($gender == "M") { echo '<p><b>Good day, Sir!</b></p>'; } elseif ($gender == "F") { echo '<p><b>Good day, Madam!</b></p>'; } else { '<p><b>You forgot to enter your gender</b></p>'; } Can you see what I forgot to do duh! I forgot to put echo in front of that statement, so easy to be blind to such an obvious error, as a technician I learned always look for the obvious and keep it simple, this, until now, had not extended to my programming skills. I am posting this so that other newbie programmers don't fall into the same trap of looking for everything else except what is right in front of their nose. Ian
  5. Good Day I might have accidentally posted this twice, sorry about that. Here is my query, I am teaching myself PHP going through the chapters in your book, all has gone well until the section on validating forms, in particular the validating of radio buttons. # script 2.3 handle_form.php Everything works as it should except when neither of the two radio buttons are selected, this code if (isset($_REQUEST['gender'])) { $gender = $_REQUEST['gender']; } else { $gender = NULL; } Does not seem to see "gender" as a result the "You forgot to enter your gender" message does not appear. I did thoroughly check my code, asked several PHP programmers I know and they all tell me it should work. So have I done something wrong, is there a bug in my version of PHP (5.5.12), if it helps I am using Wamp Server on my PC with Windows 10. Ian
×
×
  • Create New...