Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP/MYSQL table problems

Status
Not open for further replies.

bvrtrimmer

Programmer
Jul 31, 2000
2
US
Hi I have the following table (real simple): <br>CREATE TABLE txttest (comments TEXT); <br><br>I then use a &lt;textarea&gt; to type in my comment. <br>This text then gets inserted into the table above. <br>I was told to use: <br>$comments=urlencode($comments); <br>before inserting into my database <br><br>This WORKS when I type in something like: <br>&quot;this is a comment line&quot; <br>(looks like: this+is+a+comment+line) <br>BUT <br>if I type in something like: <br>&quot;this is a comment line, <br>this is another comment line&quot; <br>(looks like: this+is+a+comment+line%2C%0D%0Athis+is+another+comment+line) <br><br>I get this error: <br>Error in executing INSERT INTO txttest (comments)<br>VALUES('this+is+a+comment+line%2C%0D 0Athis+is+another+comment+line') <br>error:1065 Query was empty <br><br>ANY IDEAS?? <br><br>Thanks <br>Mike
 
Hi Mike,
don't use the urlencode function before you insert
into the sqlserver ... instead use
the addslashes() function.

Only use urlencode if your going to use the data as a link
ie.
$comment = urlencode($comment)
echo &quot;<a href=\&quot;myphpfile?foo=$comment\&quot;>blaa</a>&quot;;

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top