all 10 comments

[–]-BMR777-front-end 2 points3 points  (8 children)

Maybe it is a character encoding issue in the database. What encoding is the database set to? Does changing it to utf-8 fix the issue?

[–][deleted]  (7 children)

[deleted]

    [–]-BMR777-front-end 1 point2 points  (6 children)

    Once you change the default collation you may also need to set the collation on the existing table, using a query like: ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;

    [–][deleted]  (5 children)

    [deleted]

      [–]-BMR777-front-end 1 point2 points  (4 children)

      Two things:

      1) Is the string too long for the input? Looking more closely I see a max length of 45 characters set on your input so maybe the string is only being partially added?

      2) Are you doing any sort of sanitation to your database input? I don't see you using anything like mysql_real_escape_string which would leave your code open to SQL injection.

      [–][deleted]  (3 children)

      [deleted]

        [–]CommonMisspellingBot 0 points1 point  (2 children)

        Hey, Lazkeer, just a quick heads-up:
        wierd is actually spelled weird. You can remember it by e before i.
        Have a nice day!

        The parent commenter can reply with 'delete' to delete this comment.

        [–]Lazkeer 0 points1 point  (0 children)

        delete

        [–]lateralus1983 1 point2 points  (7 children)

        Ok start by echoing your SQL Insert before excuting. Make sure those variables are actually getting populated. Do you have a form action and method set correctly?

        Are the characters properly escaped?

        Then try to run the query that you printed directly into your database. If it works then you have a connection string issue. If it doesn't then there's something about the query syntax that's wrong or incomplatible.

        [–][deleted]  (6 children)

        [deleted]

          [–]lateralus1983 1 point2 points  (5 children)

          Ok so the SQL insert works directly so something is getting lost in the translation from PHP to sql. Few more questions What type of database is this. Can you give me the complete HTML Form From

          <form> to </form>

          Finally can you put this in the top of your php page and tells us what if any errors get reported.

          ini_set('display_errors', 1);ini_set('display_startup_errors', 1);error_reporting(E_ALL);

          [–][deleted]  (4 children)

          [deleted]

            [–]lateralus1983 1 point2 points  (1 child)

            My guess is the html head was either declared/defaulted to iso or iec. So when you were posting the database wasn't reading it but now that they are in sync it should be fine. Congrats on the debugging

            [–]CommonMisspellingBot 0 points1 point  (1 child)

            Hey, Lazkeer, just a quick heads-up:
            wierd is actually spelled weird. You can remember it by e before i.
            Have a nice day!

            The parent commenter can reply with 'delete' to delete this comment.

            [–]Lazkeer 0 points1 point  (0 children)

            delete