General discussion

  • Creator
    Topic
  • #2177056

    php and my sql

    Locked

    by my_socks_are_dirty ·

    first of all here is the php code:
    http://pastebin.com/251806

    Ok, I have the page sorta working after squishing some bugs, i’m left with an anomoly i can’t figure out….

    If i try to enter text with no spaces into the text boxes and submit, i get this error:

    Error adding client data: Unknown column ‘asdf’ in ‘field list’
    (asdf is the text i entered into the first box)

    if i enter text with spaces:

    Error adding client data: You have an error in your SQL syntax near ‘sdfs,sdfsd sdfsd,sdf sdfds)’ at line 1

    However, if i enter numbers with no spaces it works. If i enter numbers with spaces:

    Error adding client data: You have an error in your SQL syntax near ‘654546,5621 654 654,65321 4687)’ at line 1

    any help would be appreciated

All Comments

  • Author
    Replies
    • #3351445

      Reply To: php and my sql

      by jaqui ·

      In reply to php and my sql

      the link doesn’t show anything.
      no php in view source, only a blank html page

      • #3351290

        Reply To: php and my sql

        by jaqui ·

        In reply to Reply To: php and my sql

        first problem is the @ symbol in the mysql commands, it is not needed.

        mysql_connect() not @mysql_connect()

        second thing I see:
        //if (“SUBMIT” == “addclient”) {
        //$sql = “INSERT INTO cid (name,homeline1,homeline2) VALUES (‘$name’,’$homeline1′,’$homeline2′);
        //$sql = “INSERT INTO clients VALUES (”,$name,$homeline1,$homeline2)”;

        the forward slashes are commenting out the lines.

        the third that I see is you are inserting into 2 db/tables?
        insert into cid
        insert into clients
        you only connected to one db, cid.

        so:
        insert into INSERT INTO cid (name,homeline1,homeline2) VALUES (‘$name’,’$homeline1′,’$homeline2′);

        the sql isn’t needed.

      • #3351238

        Reply To: php and my sql

        by my_socks_are_dirty ·

        In reply to Reply To: php and my sql

        Poster rated this answer.

    • #3351440

      Reply To: php and my sql

      by my_socks_are_dirty ·

      In reply to php and my sql

      you can go here to view it:
      http://lodgenut.siteburg.com/index.txt

      i made a txt so you should be able to do a source view on it

      cheers

    • #3351237

      Reply To: php and my sql

      by my_socks_are_dirty ·

      In reply to php and my sql

      This question was closed by the author

Viewing 2 reply threads