how to save operators in the database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    how to save operators in the database

    hi i have an applicationa for online test in there i have to save some questions in the db now when i try to save this question
    what is 2 + 2 ?

    when i save it in the database it removes the + sign and replaces it with a white space
    any help in this
    regards,
    Omer Aslam
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    Whether "what is 2+2" is a string?

    I mean have given it as varchar in database???

    Your query can be like this.. "what is2"+"+"+"2?".. ........

    Regards
    Dheeraj Joshi

    Comment

    • Dheeraj Joshi
      Recognized Expert Top Contributor
      • Jul 2009
      • 1129

      #3
      I think above query works..

      Just try....

      Regards
      Dheeraj Joshi

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by omerbutt
        hi i have an applicationa for online test in there i have to save some questions in the db now when i try to save this question
        what is 2 + 2 ?

        when i save it in the database it removes the + sign and replaces it with a white space
        any help in this
        regards,
        Omer Aslam
        That doesn't sound right - what database are you using? What's the table set-up? What's your SQL look like? How does the PHP look?

        Mark.

        Comment

        • omerbutt
          Contributor
          • Nov 2006
          • 638

          #5
          Originally posted by Markus
          That doesn't sound right - what database are you using? What's the table set-up? What's your SQL look like? How does the PHP look?

          Mark.
          icurrently have
          MySQL client version: 5.0.51a
          Apache/2.2.11
          PHP Version 5.2.9

          the database engine i am using is MYISAM
          The table has a field name question title that is VARCHAR (255) and i am trying to save in that field
          regards,
          Omer Aslam

          Comment

          • Markus
            Recognized Expert Expert
            • Jun 2007
            • 6092

            #6
            The SQL? The PHP? Going to have to see it if we're to make an informed answer.

            Comment

            • hsriat
              Recognized Expert Top Contributor
              • Jan 2008
              • 1653

              #7
              This doesn't seem like a PHP or MySQL problem, but there's some URI encoding problem.

              Somewhere in the process, probable when submitting this string from front end to php, you are skipping URI encoding.

              Comment

              • Dheeraj Joshi
                Recognized Expert Top Contributor
                • Jul 2009
                • 1129

                #8
                Does the problem still persist?

                Is it only with + symbol? or with any mathematical symbols like - * / % ^ etc etc?

                Regards
                Dheeraj Joshi

                Comment

                Working...