General discussion

Locked

php and my sql

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

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

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

Collapse -

by Jaqui In reply to

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.

Collapse -

by my_socks_are_dirty In reply to

Poster rated this answer.

Collapse -

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

Collapse -

by my_socks_are_dirty In reply to php and my sql

This question was closed by the author

Back to Web Development Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums