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.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    not inserting anything

    this piece of code is killing me:

    I'm inserting marks for school in MySQL table.
    When I want to insert new record, nothing happens,
    there is no new record.
    When I want to update record, same thing. Nothing.
    Deleting records is fine.

    I'm giving you the full code because I don't know what to cut off.
    Please help, it's quite urgent. In fact very urgent.

    edit.php
    -------------------------------------
    change attachment from txt in php.
    -------------------------------------
    Kind regards
    DZvonko
    Attached Files Attached Files

  • #2
    bdl
    bdl is offline
    Regular Coder
    Join Date
    Apr 2007
    Location
    Camarillo, CA US
    Posts
    590
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Hmm. You have two lines that perform either an UPDATE or an INSERT statement, and they both look like this:
    PHP Code:
    mysql_query($sql); 
    You should add some additional troubleshooting in there (temporarily) that throws an error message and optionally gives you the SQL statement, e.g.
    PHP Code:
    mysql_query($sql) OR die("Query error:<br>{$sql}<br>" .mysql_error()); 
    At the very least you should make certain the $sql variable contains a valid SQL statement.

    Likewise, this query statement:
    PHP Code:
    $result mysql_query("SELECT * FROM 6oceni WHERE redbr=".$red_br); 
    Should do the same. Make certain the value $red_br is an INTEGER type, and that it has a value.

    Additionally, all of your $_REQUEST references should be $_POST. It's too easy to use a GET string value and throw off your code or invite an attack of some sort. Make sure you look into SQL injection and either parameterize your queries or at least validate and escape them using mysql_real_escape_string().

  • #3
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can you help me to separate insert and update? Don't have to be piece of art, just to do the job. I am novice and this is little confusing. Thanks.

  • #4
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    I wasn't able to find an insert or update query in that file.
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?

  • #5
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is complete code in zip. I can't insert new record.
    I can't understand. It's a bit urgent and I need some
    beautification and make up to make. Please help!
    Attached Files Attached Files

  • #6
    New to the CF scene
    Join Date
    Feb 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone? help?! have somebody look at the code?

  • #7
    Senior Coder
    Join Date
    May 2005
    Posts
    2,137
    Thanks
    96
    Thanked 72 Times in 72 Posts
    That can take weeks to go through. Also why is index named index8?
    Rowsdower! has accused me of having mental problems, and the administrator allowed it. What a great forum huh?


  •  

    Posting Permissions

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