Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    New Coder
    Join Date
    Aug 2013
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    You see how much simpler this could have been if you had simply done what I asked your for in my post #4? If you had shown me the query that had the problem FIRST you would have had your answer ALMOST TWO DAYS AGO.

    When posting questions in forums, don't make us DRAG the details out of you! Give *ALL* the relevant information in your FIRST post.


    thank u lot... now what i change in that code. pls post the code

  2. #17
    New Coder
    Join Date
    Aug 2013
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    BINGO!

    Look right there!

    Code:
    UPDATE subject SET subname='Englishh', comment='fhjfbg', courseid='', subtype='Language', semester='1', lecid='' WHERE subid = '1'
    Just *EXACTLY* what the error message told you:

    The value for courseid in the subject table *MUST MATCH* one of the values of courseid in the course table.

    The only valid values for courseid in the course table are:
    Code:
    mysql> select * from course;
    +----------+----------------------------------+------------------------------------------------+-----------+
    | courseid | coursename                       | comment                                        | coursekey |
    +----------+----------------------------------+------------------------------------------------+-----------+
    |        1 | Bachelor of Arts                 | This Course is related to Arts field.          | BA        |
    |        2 | Bachelor of Commerce             | This course is related to commerce field.      | BCom      |
    |        3 | Bachelor of Bussiness Management | This course is related to Bussiness field.     | BBM       |
    |        4 | Bachelor of Science              | This field is related to science field.        | BSc       |
    |        5 | Bachelor of Computer Application | This field is related to computer field.       | BCA       |
    |        6 | Bachelor of Social Work          | This field is related to social welfare field. | BSW       |
    +----------+----------------------------------+------------------------------------------------+-----------+
    I might also point out that your fields subid, courseid, and lecid in your subject table are all defined as BIGINT fields, and so you MUST put *NUMBERS* into them. Meaning that you should *NOT* HAVE APOSTROPHES in the places shown here:
    Code:
    UPDATE subject SET subname='Englishh', comment='fhjfbg', courseid='', subtype='Language', semester='1', lecid='' WHERE subid = '1'
    Also, number fields can *NOT* be blank! You MUST supply either a number for courseid, lecid, and subid or use the keyword NULL (without parentheses). *EXAMPLE*:
    Code:
    UPDATE subject SET subname='Englishh', comment='fhjfbg', courseid=1, subtype='Language', semester='1', lecid=1 WHERE subid = 1
    where i should remove the apostopheres...? where i change the code? pls post that code

  3. #18
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Remove the RED apostrophes in the line that has them in my last post.

    But now you need to make sure you give a *NUMBER* for courseid and lecid.

    *OR* don't give ANY value at all.

    I can NOT tell you what to do, because it depends on your PHP code and it depends on the <form> you POSTed from.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •