Empty tables are being created..?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhishek1234321
    New Member
    • Jul 2010
    • 18

    Empty tables are being created..?

    i have a php code in which i create a table and insert the variable's data. when i echo the data. its shown correctly. but when i try that again the tables are empty,
    for example,


    i have the code at http://www.vtuhub.com if i type 3BK08EC043 in the form it fetches the data from results.vtu.ac. in site... and shows it and stores it in my database... but when i try the same 3BK08EC043 again... it shows the the data is "available in database"... but its not showing it.. that is... empty data is being inserted in the table...?? can anyone help me out..?
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    Not without any code to view

    Comment

    • abhishek1234321
      New Member
      • Jul 2010
      • 18

      #3
      I removed the code

      Comment

      • abhishek1234321
        New Member
        • Jul 2010
        • 18

        #4
        can u help me out.. whats the prob..?

        Comment

        • abhishek1234321
          New Member
          • Jul 2010
          • 18

          #5
          hey dude give me ur email id.. i don't want any1 to use this code.. i'll remove it from here pls..:)

          Comment

          • code green
            Recognized Expert Top Contributor
            • Mar 2007
            • 1726

            #6
            i don't want any1 to use this code
            It can't be so good if you need help here to make it work!
            Besides, we only need to see the problem code not all of it.
            If you don't know where the problem is, then I suggest putting some error trapping and test output to trace the problem

            Comment

            • abhishek1234321
              New Member
              • Jul 2010
              • 18

              #7
              $em=mysql_query ("INSERT INTO $value (marks) VALUES ($x)");

              in this the field marks is being created.. but the data isn't being inserted... all i wanna knw is if there is any single quote in the string(the string contains the html) will that coz an error..?

              Comment

              • code green
                Recognized Expert Top Contributor
                • Mar 2007
                • 1726

                #8
                Wrap the value in quotes
                Code:
                $em=mysql_query("INSERT INTO $value (marks) VALUES ('$x')");

                Comment

                • Atli
                  Recognized Expert Expert
                  • Nov 2006
                  • 5062

                  #9
                  Originally posted by abhishek1234321
                  all i wanna knw is if there is any single quote in the string(the string contains the html) will that coz an error..?
                  Yes. MySQL strings are wrapped in single-quotes (like in @code green's example). Putting a single-quote into a single-quote delimited string will, obviously, cause a parse error.

                  We use the mysql_real_esca pe_string function to avoid problems like this. It replaces all characters in a string that would cause a problem to a MySQL query with safe alternatives.

                  Comment

                  Working...