Jump to content

[SOLVED] allowing html tags in sql submit


Zeradin

Recommended Posts

I am trying to update a field in my sql table from an html form like this:

 

if ($pblurb != NULL) {
$pblurbquery = 'UPDATE users SET pblurb = "'.$pblurb.'" WHERE username = "'.$username.'"';
$pblurbresult=mysql_query($pblurbquery);

 

but i want the input to allow html tags. When they are included in the form i get a return code 4 and it does not change the entry. how do i allow for html in my input?

 

i know this is probably a common problem but sifting through all the replies that sound kind of like this is proving to be difficult.

 

thanks!

Link to comment
Share on other sites

Do this:

if(!$pblurbresult=mysql_query($pblurbquery)) echo mysql_error();

this will display any mysql errors

 

And problem with query

$pblurbquery = "UPDATE users SET pblurb = '$pblurbEscaped' WHERE username = '$username'";

 

Link to comment
Share on other sites

if ($pblurb != NULL) {
$pblurbEscaped = mysql_real_escape_string($pblurb);
$pblurbquery = "UPDATE users SET pblurb = '$pblurbEscaped' WHERE username = '$username'";
$pblurbresult=mysql_query($pblurbquery);
if(!$pblurbresult=mysql_query($pblurbquery)) echo mysql_error();
}

 

that didn't do anything differently =(

Link to comment
Share on other sites

if ($pblurb != NULL) {
$pblurbEscaped = mysql_real_escape_string($pblurb);
$pblurbquery = "UPDATE users SET pblurb = '$pblurbEscaped' WHERE username = '$username'";
if(!$pblurbresult=mysql_query($pblurbquery)) echo mysql_error();
}

Try

echo $pblurbquery;

to see if query is well formed

Link to comment
Share on other sites

UPDATE users SET pblurb = "This is my profile blurb. I\'m worried quotes are a problem." WHERE id = 7Return Code: 4

 

when it shows the profile blurb it puts it in bold... shit i took the bold tag out and it still has the error, it's obviously another problem.

 

i changed it to id to make it more simple as well

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.